================
@@ -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()) {
----------------
CarolineConcatto wrote:

Hi @nikic ,

So here I am considering  what is best for the print, I thought about 2 
solution:
1) Have function to find the most common target ModRefInfo 
getOtherTargetMem(){
//Do a loop to all locations to see the most common target mem
}
Problem is what if it is  all evenly  split, how should it choose? Does not 
look like a nice solution.
or
2) Add a target_mem, like Other, and do the same we do for the other locations:
```
 ModRefInfo OtherTargetMR = ME.getModRef(IRMemLocation::TargetMem);

     if (MR == OtherTargetMR)
        continue;
```
But to do that I will need to add another location in:
```
enum class IRMemLocation {
..
 /// Represents target specific state.
  TargetMem0 = 4,
  TargetMem1 = 5,
   TargetMem= 6,
```
Do you have any thought on that?

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