[PATCH] D130225: [Attributor] Check for noalias call in AAInstanceInfo

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 00:57:06 PDT 2022


nikic created this revision.
Herald added subscribers: ormris, jeroen.dobbelaere, okura, jdoerfert, kuter, hiraditya.
Herald added a reviewer: homerdin.
Herald added a project: All.
nikic requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

TBH I don't really understand what this code is doing, but going just by naming, it seems like the relevant property of allocation functions of interest here is their uniqueness (in the sense of disjoint provenance), which is encoded by the `noalias` return attribute. Or does this rely on some other property of allocators as well?


https://reviews.llvm.org/D130225

Files:
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp


Index: llvm/lib/Transforms/IPO/AttributorAttributes.cpp
===================================================================
--- llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -4825,11 +4825,8 @@
     auto EquivalentUseCB = [&](const Use &OldU, const Use &NewU) {
       if (auto *SI = dyn_cast<StoreInst>(OldU.getUser())) {
         auto *Ptr = SI->getPointerOperand()->stripPointerCasts();
-        if (isa<AllocaInst>(Ptr) && AA::isDynamicallyUnique(A, *this, *Ptr))
-          return true;
-        auto *TLI = A.getInfoCache().getTargetLibraryInfoForFunction(
-            *SI->getFunction());
-        if (isAllocationFn(Ptr, TLI) && AA::isDynamicallyUnique(A, *this, *Ptr))
+        if ((isa<AllocaInst>(Ptr) || isNoAliasCall(Ptr)) &&
+            AA::isDynamicallyUnique(A, *this, *Ptr))
           return true;
       }
       return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130225.446375.patch
Type: text/x-patch
Size: 907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220721/53655c40/attachment.bin>


More information about the llvm-commits mailing list