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

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 20:46:07 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 *>(
----------------
shiltian wrote:

> because the use of setMask and getOrCreateAAFor will return a const pointer, so I have to const_cast it....

That is a bad design. I don't think you need to care about other bits.

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


More information about the llvm-commits mailing list