[llvm] Attributor: Add noalias.addrspace attribute for store and load (PR #136553)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 19:24:46 PDT 2025


================
@@ -1390,9 +1390,17 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
       if (auto *LI = dyn_cast<LoadInst>(&I)) {
         A.getOrCreateAAFor<AAAddressSpace>(
             IRPosition::value(*LI->getPointerOperand()));
+        const_cast<AANoAliasAddrSpace *>(
+            A.getOrCreateAAFor<AANoAliasAddrSpace>(
+                IRPosition::value(*LI->getPointerOperand())))
+            ->setMask(AddrSpaceMask);
       } else if (auto *SI = dyn_cast<StoreInst>(&I)) {
         A.getOrCreateAAFor<AAAddressSpace>(
             IRPosition::value(*SI->getPointerOperand()));
+        const_cast<AANoAliasAddrSpace *>(
+            A.getOrCreateAAFor<AANoAliasAddrSpace>(
+                IRPosition::value(*SI->getPointerOperand())))
----------------
Shoreshen wrote:

Hi @arsenm , in order to use underlying obj attribute, we either extract here or do this inside the attribute. Currently it follows the addrspace attribute

https://github.com/llvm/llvm-project/pull/136553


More information about the llvm-commits mailing list