Fix http://llvm.org/bugs/show_bug.cgi?id=2104 by ordering lexicographically what...
authorGabor Greif <ggreif@gmail.com>
Thu, 28 Feb 2008 08:38:45 +0000 (08:38 +0000)
committerGabor Greif <ggreif@gmail.com>
Thu, 28 Feb 2008 08:38:45 +0000 (08:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47712 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/AliasAnalysisEvaluator.cpp
test/Analysis/BasicAA/2007-08-01-NoAliasAndGEP.ll

index d8182d0eec886e09abd13f0b8e56a7095a20fff3..1ed06805fa62b2dfa206b37a6116a1df787d8a88 100644 (file)
@@ -31,6 +31,7 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Streams.h"
 #include <set>
+#include <sstream>
 using namespace llvm;
 
 namespace {
@@ -80,12 +81,18 @@ namespace {
 
 FunctionPass *llvm::createAAEvalPass() { return new AAEval(); }
 
-static inline void PrintResults(const char *Msg, bool P, Value *V1, Value *V2,
-                                Module *M) {
+static void PrintResults(const char *Msg, bool P, const Value *V1, const Value *V2,
+                         const Module *M) {
   if (P) {
-    cerr << "  " << Msg << ":\t";
-    WriteAsOperand(*cerr.stream(), V1, true, M) << ", ";
-    WriteAsOperand(*cerr.stream(), V2, true, M) << "\n";
+    std::stringstream s1, s2;
+    WriteAsOperand(s1, V1, true, M);
+    WriteAsOperand(s2, V2, true, M);
+    std::string o1(s1.str()), o2(s2.str());
+    if (o2 < o1)
+        std::swap(o1, o2);
+    cerr << "  " << Msg << ":\t"
+         << o1 << ", "
+         << o2 << "\n";
   }
 }
 
index 5a2373e401e892787ece3abb9726ffa1e3741bf6..9936afb1956054306c31efef4e77f67e58760dfa 100644 (file)
@@ -1,6 +1,6 @@
 ; RUN: llvm-as %s -o - | opt -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {9 no alias}
 ; RUN: llvm-as %s -o - | opt -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {6 may alias}
-; RUN: llvm-as %s -o - | opt -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {MayAlias:.*i32\\* %Jpointer, i32\\* %Ipointer}
+; RUN: llvm-as %s -o - | opt -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {MayAlias:.*i32\\* %Ipointer, i32\\* %Jpointer}
 
 define void @foo(i32* noalias %p, i32* noalias %q, i32 %i, i32 %j) {
   %Ipointer = getelementptr i32* %p, i32 %i