[llvm] Extend MemoryEffects to Support Target-Specific Memory Locations (PR #148650)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 24 07:16:56 PDT 2025


================
@@ -142,6 +142,9 @@ static void addLocAccess(MemoryEffects &ME, const MemoryLocation &Loc,
     ME |= MemoryEffects::argMemOnly(MR);
   ME |= MemoryEffects(IRMemLocation::ErrnoMem, MR);
   ME |= MemoryEffects(IRMemLocation::Other, MR);
+  // Should also set the other Target Memory Locations as MR.
+  // To compares with MemoryEffects::unknown() in addMemoryAttrs
+  ME |= MemoryEffects::setTargetMemLocationModRef(MR);
----------------
paulwalker-arm wrote:

This look suspicious.  The comment say's "it might be an argument" and passing "inaccessible memory" as an argument doesn't seem plausible. Looking at the two call sites I see one in `addArgLocs` which wouldn't be relevant based on the above and then `checkFunctionMemoryAccess` which already has dedicate handling for call instructions that touch inaccessible memory:
```
      // Merge callee's memory effects into caller's ones, including
      // inaccessible and errno memory, but excluding argument memory, which is
      // handled separately.
      ME |= CallME.getWithoutLoc(IRMemLocation::ArgMem);
```

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


More information about the llvm-commits mailing list