This is an archive of the discontinued LLVM Phabricator instance.

[MemoryBuiltins] Add isMallocOrCallocLikeFn so BasicAA can check for both at the same time
ClosedPublic

Authored by craig.topper on Apr 18 2017, 1:57 PM.

Details

Summary

BasicAA wants to know if a function is either a malloc or calloc like function. Currently we have to check both separately. This means both calls check if its an intrinsic, query TLI, check the nobuiltin attribute, scan the AllocationFnData, etc.

This patch adds a isMallocOrCallocLikeFn so we can go through all of the checks once per call.

This also changes the one other location I saw that called both together.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Apr 18 2017, 1:57 PM

if we get more of these, it might make sense to surface AllocType so the user can directly ask for whatever kind of function they want.

for now though, this patch LGTM. thanks!

This revision is now accepted and ready to land.Apr 18 2017, 2:46 PM
This revision was automatically updated to reflect the committed changes.