[polly] r174329 - ScopDetection: Improve printing of alias sets

Tobias Grosser grosser at fim.uni-passau.de
Mon Feb 4 07:46:25 PST 2013


Author: grosser
Date: Mon Feb  4 09:46:25 2013
New Revision: 174329

URL: http://llvm.org/viewvc/llvm-project?rev=174329&view=rev
Log:
ScopDetection: Improve printing of alias sets

We now show the all members of the alias set that may couse possible aliasing.
In case a alias set member is not a named instruction (unnamed instructions or
constant expressions), we show the expression itself.

This improves our error message

from:

  Possible aliasing for value: .reg2mem

to:

  Possible aliasing: ".reg2mem",
                     "[0 x double]* inttoptr (i64 47255179264 to [0 x double]*)

Modified:
    polly/trunk/lib/Analysis/ScopDetection.cpp

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=174329&r1=174328&r2=174329&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Mon Feb  4 09:46:25 2013
@@ -277,10 +277,38 @@ bool ScopDetection::isValidMemoryAccess(
   // references which seem to alias, if -basicaa is not available. They actually
   // do not, but as we can not proof this without -basicaa we would fail. We
   // disable this check to not cause irrelevant verification failures.
-  if (!AS.isMustAlias() && !IgnoreAliasing)
-    INVALID_NOVERIFY(Alias,
-                     "Possible aliasing for value: " << BaseValue->getName()
-                     << "\n");
+  if (!AS.isMustAlias() && !IgnoreAliasing) {
+    std::string Message;
+    raw_string_ostream OS(Message);
+
+    OS << "Possible aliasing: ";
+
+    std::vector<Value*> Pointers;
+
+    for (AliasSet::iterator AI = AS.begin(), AE = AS.end(); AI != AE; ++AI)
+      Pointers.push_back(AI.getPointer());
+
+    std::sort(Pointers.begin(), Pointers.end());
+
+    for (std::vector<Value*>::iterator PI = Pointers.begin(),
+         PE = Pointers.end();;) {
+      Value *V = *PI;
+
+      if (V->getName().size() == 0)
+        OS << "\"" << *V << "\"";
+      else
+        OS << "\"" << V->getName() << "\"";
+
+      ++PI;
+
+      if (PI != PE)
+        OS << ", ";
+      else
+        break;
+    }
+
+    INVALID_NOVERIFY(Alias, OS.str())
+  }
 
   return true;
 }





More information about the llvm-commits mailing list