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

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 07:15:07 PDT 2025


================
@@ -374,7 +375,19 @@ void CodeGenIntrinsic::setProperty(const Record *R) {
     ME &= MemoryEffects::argMemOnly();
   else if (R->getName() == "IntrInaccessibleMemOnly")
     ME &= MemoryEffects::inaccessibleMemOnly();
-  else if (R->getName() == "IntrInaccessibleMemOrArgMemOnly")
+  else if (R->isSubClassOf("IntrInaccessibleReadMemOnly")) {
+    llvm::IRMemLocation Loc = getValueAsIRMemLocation(R, "Loc");
+    if (ME.onlyAccessTargetMemoryLocation())
+      ME = ME.getWithModRef(Loc, ModRefInfo::Ref);
+    else
+      ME &= MemoryEffects::inaccessibleReadMemOnly(Loc);
----------------
CarolineConcatto wrote:

I have a problem when doing:
ME &= ReadMask;
Because Memory Effect starts by being set to:
```
  /// Memory effects of the intrinsic.
  MemoryEffects ME = MemoryEffects::unknown();
```
This sets all bits from MemoryLocations to 1.
So it will have to check to keep the logic here to be correct

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


More information about the llvm-commits mailing list