================
@@ -630,14 +630,24 @@ std::string Attribute::getAsString(bool InAttrGrp) const {
     // Print access kind for "other" as the default access kind. This way it
     // will apply to any new location kinds that get split out of "other".
     ModRefInfo OtherMR = ME.getModRef(IRMemLocation::Other);
+    ModRefInfo InaccessibleMemMR = 
ME.getModRef(IRMemLocation::InaccessibleMem);
     if (OtherMR != ModRefInfo::NoModRef || ME.getModRef() == OtherMR) {
       First = false;
       OS << getModRefStr(OtherMR);
     }
 
     for (auto Loc : MemoryEffects::locations()) {
       ModRefInfo MR = ME.getModRef(Loc);
-      if (MR == OtherMR)
+      // Skip target memory location
+      if (MR == OtherMR && !ME.isTargetMemLoc(Loc))
+        continue;
+
+      // Prints Target Memory Location if ModRefInfo from InaccessibleMem
+      // differs from Target_MemX
+      // or ModRefInfo from Target Memory Location is NoModRef as OtherMR
+      // Otherwise skip Target_Mem print
+      if ((ME.isTargetMemLoc(Loc) && MR == InaccessibleMemMR) ||
+          (MR == OtherMR && OtherMR == ModRefInfo::NoModRef))
----------------
paulwalker-arm wrote:

I've been trying to figure out why this is more complicated than I expected, 
especially because I suspect it doesn't quite matches the new rule used for 
parsing.

I think it comes from fixing output difference caused by tests that use the old 
style memory attributes prior to `memory()`. The real cause for those 
differences is their parsing not implementing the new rule relating to the 
relationship between InaccessibleMem and TargetMem.  However, I've done a 
deeper investigation and I now think we're just looking for trouble[1] when 
trying to minimise the test changes. It seems I also misunderstood the extent 
of those changes, which looks to be only ~10 files?

Assuming I've not misrepresented something, let's keep things simple and just 
remove the special print/parse code and update the tests accordingly.

[1] Part of the problem here is bitcode. For those cases target memory 
effectively defaults to `none`, so when tying to be clever we've actually just 
caused a discrepancy between how ll and bc files interpret the same data. We 
will need to change bitcode but that cannot happen until we start actively 
using the new target memory locations.'


https://github.com/llvm/llvm-project/pull/148650
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to