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

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 01:25:39 PDT 2025


================
@@ -640,6 +640,10 @@ std::string Attribute::getAsString(bool InAttrGrp) const {
       if (MR == OtherMR)
         continue;
 
+      // Dont want to print Target Location if NoModRef
+      if (ME.isTargetMemLoc(Loc) && (MR == ModRefInfo::NoModRef))
+        continue;
----------------
CarolineConcatto wrote:

Do we want to print the targetmem status even when it is NoModRef
If we remove this all the tests will need to be updated to print targetmem as well.
So this:
attributes #0 = { nounwind memory(readwrite, inaccessiblemem: none) }
will become this:
attributes #0 = { nounwind memory(readwrite, inaccessiblemem: none, target_mem0: none, target_mem1: none) }

But strange that it is not always. Only in some cases. This happens when :
MR that is the ModRef is the location  ModRefInfo MR = ME.getModRef(Loc); is different than Other. Because other is the default.
// Print access kind for "other" as the default access kind.
 if (MR == OtherMR)

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


More information about the llvm-commits mailing list