[llvm] 32017d5 - [Attributor] Check for noalias call in AAInstanceInfo

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 01:28:12 PDT 2022


Author: Nikita Popov
Date: 2022-08-10T10:27:14+02:00
New Revision: 32017d5efec598478a75c2c0027f64b71bd2ea4e

URL: https://github.com/llvm/llvm-project/commit/32017d5efec598478a75c2c0027f64b71bd2ea4e
DIFF: https://github.com/llvm/llvm-project/commit/32017d5efec598478a75c2c0027f64b71bd2ea4e.diff

LOG: [Attributor] Check for noalias call in AAInstanceInfo

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.

Differential Revision: https://reviews.llvm.org/D130225

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 05e074832beda..eda0899aacc57 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -4845,11 +4845,8 @@ struct AAInstanceInfoImpl : public AAInstanceInfo {
     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;


        


More information about the llvm-commits mailing list