================
@@ -653,15 +653,26 @@ std::string Attribute::getAsString(bool InAttrGrp) const {
       OS << getModRefStr(OtherMR);
     }
 
+    bool TargetPrintedForAll = false;
     for (auto Loc : MemoryEffects::locations()) {
       ModRefInfo MR = ME.getModRef(Loc);
       if (MR == OtherMR)
         continue;
 
-      if (!First)
+      if (!First && !TargetPrintedForAll)
         OS << ", ";
       First = false;
 
+      if (ME.isTargetMemLoc(Loc) && ME.isTargetMemLocSameForAll()) {
----------------
nikic wrote:

I think the behavior that we'd actually want here is to take the most common 
value for target_mem and then print separately the ones that differ. Though 
with currently only 2 target memory locations this makes no difference. It 
would only become relevant if there are more (e.g. if we expand to 8 target 
memory locations and only 1 of them differs).

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

Reply via email to