[PATCH] D117084: [CFLGraph] Change isMallocOrCallocLikeFn to isNoAliasCall now that allocation functions must be marked noalias

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 17 08:26:59 PST 2022


reames added a comment.

I went and took a slightly deeper look at this code, and unfortunately, I think we have a couple of interacting issues here we will need to fix if we want to remove the isMallocOrCallocLike check.

Issue 1 - The inter-procedural inference code does not appear to restrict results based on call site attributes.  It appears to only look at function attributes.  This means that a call site which is annotated inaccessiblememonly to a call which isn't would get the conservative answer, not the precise one.

Issue 2 - The inter-procedural inference code (getAliasSummary) does not appear to incorporate function attributes into the result at all.  (I may be misreading this code, it's horribly "generic" and really hard to figure out what it is actually doing.)

Issue 3 - The cumulative result of the previous two is that letting noalias only trigger if inter-procedural doesn't is a regression.

I think what I'd suggest is that rather than removing this code, we focus on simple generalizing it.

I believe the property isMallocOrCallLike is actually checking for here is: a noalias function whose only side effect is inaccessiblememonly.  We can generalize the check - with added test coverage - and at least remove the overly specific call.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117084/new/

https://reviews.llvm.org/D117084



More information about the llvm-commits mailing list