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

Bryce Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 12:03:41 PST 2022


Bryce-MW updated this revision to Diff 399412.
Bryce-MW added a comment.

- Use onlyAccessesInaccessibleMemory instead


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117084

Files:
  llvm/lib/Analysis/CFLGraph.h


Index: llvm/lib/Analysis/CFLGraph.h
===================================================================
--- llvm/lib/Analysis/CFLGraph.h
+++ llvm/lib/Analysis/CFLGraph.h
@@ -429,12 +429,9 @@
       if (Call.getType()->isPointerTy())
         addNode(&Call);
 
-      // Check if Inst is a call to a library function that
-      // allocates/deallocates on the heap. Those kinds of functions do not
-      // introduce any aliases.
-      // TODO: address other common library functions such as realloc(),
-      // strdup(), etc.
-      if (isMallocOrCallocLikeFn(&Call, &TLI) || isFreeCall(&Call, &TLI))
+      // Check if Inst is a call to a library function that frees memory. Those
+      // kinds of functions do not introduce any aliases.
+      if (isFreeCall(&Call, &TLI))
         return;
 
       // TODO: Add support for noalias args/all the other fun function
@@ -448,7 +445,7 @@
       // could have happened to the arguments (unless the function is marked
       // readonly or readnone), and that the result could alias just about
       // anything, too (unless the result is marked noalias).
-      if (!Call.onlyReadsMemory())
+      if (!(Call.onlyReadsMemory() || Call.onlyAccessesInaccessibleMemory()))
         for (Value *V : Call.args()) {
           if (V->getType()->isPointerTy()) {
             // The argument itself escapes.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117084.399412.patch
Type: text/x-patch
Size: 1355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220112/ab0aa498/attachment.bin>


More information about the llvm-commits mailing list