Use WriteAsOperand instead of getName() to print loop header names,
authorDan Gohman <gohman@apple.com>
Sat, 9 Jan 2010 18:17:45 +0000 (18:17 +0000)
committerDan Gohman <gohman@apple.com>
Sat, 9 Jan 2010 18:17:45 +0000 (18:17 +0000)
so that unnamed blocks are handled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93059 91177308-0d34-0410-b5e6-96231b3b80d8

22 files changed:
lib/Analysis/IVUsers.cpp
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll
test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll
test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll
test/Analysis/ScalarEvolution/2008-11-18-Stride1.ll
test/Analysis/ScalarEvolution/avoid-smax-0.ll
test/Analysis/ScalarEvolution/max-trip-count.ll
test/Analysis/ScalarEvolution/nsw-offset.ll
test/Analysis/ScalarEvolution/nsw.ll
test/Analysis/ScalarEvolution/sext-inreg.ll
test/Analysis/ScalarEvolution/sext-iv-0.ll
test/Analysis/ScalarEvolution/sext-iv-1.ll
test/Analysis/ScalarEvolution/sext-iv-2.ll
test/Analysis/ScalarEvolution/trip-count3.ll
test/Analysis/ScalarEvolution/trip-count7.ll
test/Analysis/ScalarEvolution/trip-count8.ll
test/Analysis/ScalarEvolution/zext-wrap.ll
test/Transforms/IndVarSimplify/shrunk-constant.ll
test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll

index df9e31c1d2534d801f21900b22fa2f1f7b1cd764..26c0c9e4ba8fa2a19ca2b8ec2e19688bebcfeff0 100644 (file)
@@ -128,8 +128,9 @@ static bool getSCEVStartAndStride(const SCEV *&SH, Loop *L, Loop *UseLoop,
     if (!AddRecStride->properlyDominates(Header, DT))
       return false;
 
-    DEBUG(dbgs() << "[" << L->getHeader()->getName()
-                 << "] Variable stride: " << *AddRec << "\n");
+    DEBUG(dbgs() << "[";
+          WriteAsOperand(dbgs(), L->getHeader(), /*PrintType=*/false);
+          dbgs() << "] Variable stride: " << *AddRec << "\n");
   }
 
   Stride = AddRecStride;
index 17dc686a4259c788a6c3e3d741ea2dba4d1d5ec8..4d85ce43d20126b9c02f0a7506a4856ef25b5c0c 100644 (file)
@@ -316,7 +316,9 @@ void SCEVAddRecExpr::print(raw_ostream &OS) const {
   OS << "{" << *Operands[0];
   for (unsigned i = 1, e = Operands.size(); i != e; ++i)
     OS << ",+," << *Operands[i];
-  OS << "}<" << L->getHeader()->getName() + ">";
+  OS << "}<";
+  WriteAsOperand(OS, L->getHeader(), /*PrintType=*/false);
+  OS << ">";
 }
 
 void SCEVFieldOffsetExpr::print(raw_ostream &OS) const {
@@ -5193,7 +5195,9 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
   for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
     PrintLoopInfo(OS, SE, *I);
 
-  OS << "Loop " << L->getHeader()->getName() << ": ";
+  OS << "Loop ";
+  WriteAsOperand(OS, L->getHeader(), /*PrintType=*/false);
+  OS << ": ";
 
   SmallVector<BasicBlock *, 8> ExitBlocks;
   L->getExitBlocks(ExitBlocks);
@@ -5206,8 +5210,10 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
     OS << "Unpredictable backedge-taken count. ";
   }
 
-  OS << "\n";
-  OS << "Loop " << L->getHeader()->getName() << ": ";
+  OS << "\n"
+        "Loop ";
+  WriteAsOperand(OS, L->getHeader(), /*PrintType=*/false);
+  OS << ": ";
 
   if (!isa<SCEVCouldNotCompute>(SE->getMaxBackedgeTakenCount(L))) {
     OS << "max backedge-taken count is " << *SE->getMaxBackedgeTakenCount(L);
@@ -5227,7 +5233,9 @@ void ScalarEvolution::print(raw_ostream &OS, const Module *) const {
   // const isn't dangerous.
   ScalarEvolution &SE = *const_cast<ScalarEvolution *>(this);
 
-  OS << "Classifying expressions for: " << F->getName() << "\n";
+  OS << "Classifying expressions for: ";
+  WriteAsOperand(OS, F, /*PrintType=*/false);
+  OS << "\n";
   for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
     if (isSCEVable(I->getType())) {
       OS << *I << '\n';
@@ -5256,7 +5264,9 @@ void ScalarEvolution::print(raw_ostream &OS, const Module *) const {
       OS << "\n";
     }
 
-  OS << "Determining loop execution counts for: " << F->getName() << "\n";
+  OS << "Determining loop execution counts for: ";
+  WriteAsOperand(OS, F, /*PrintType=*/false);
+  OS << "\n";
   for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)
     PrintLoopInfo(OS, &SE, *I);
 }
index 7f82ea43579111702c038f744f4ec30c8f6e5949..ba57662a81d949e6e3fcf7635e9a95c78f4ee539 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -analyze -scalar-evolution -disable-output \
-; RUN:   -scalar-evolution-max-iterations=0 | grep {Loop bb: backedge-taken count is 100}
+; RUN:   -scalar-evolution-max-iterations=0 | grep {Loop %bb: backedge-taken count is 100}
 ; PR1533
 
 @array = weak global [101 x i32] zeroinitializer, align 32             ; <[100 x i32]*> [#uses=1]
index f623da1b2757563f4b455f0cb294e22251198584..ce8f72511f9c50e7b329ed57437a2576b8bbcd1c 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -scalar-evolution -analyze -disable-output | grep {Loop bb: backedge-taken count is (-1 + (-1 \\* %x) + %y)}
+; RUN: opt < %s -scalar-evolution -analyze -disable-output | grep {Loop %bb: backedge-taken count is (-1 + (-1 \\* %x) + %y)}
 ; PR1597
 
 define i32 @f(i32 %x, i32 %y) {
index c8e483e7d50f9569261e71b2642e1a8852784e38..6685778d5551ce33012c43225a40c95c7170bae9 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -scalar-evolution -analyze -disable-output | grep {Loop header: backedge-taken count is (0 smax %n)}
+; RUN: opt < %s -scalar-evolution -analyze -disable-output | grep {Loop %header: backedge-taken count is (0 smax %n)}
 
 define void @foo(i32 %n) {
 entry:
index cb9a1829eb7c05bee08d9c52424062482350856a..addf346825ef89cbd12c2e8fcdc7d5e4644f36e0 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -scalar-evolution -analyze -disable-output | grep {Loop loop: backedge-taken count is (100 + (-100 smax %n))}
+; RUN: opt < %s -scalar-evolution -analyze -disable-output | grep {Loop %loop: backedge-taken count is (100 + (-100 smax %n))}
 ; PR2002
 
 define void @foo(i8 %n) {
index daeb26a202e3c04d18ec6d980d6e0fb7e3ca7830..f9dd40f8b5ccb67f8d03024d0e477308ab815aac 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -analyze -scalar-evolution -disable-output |& \
-; RUN: grep {Loop bb: backedge-taken count is (7 + (-1 \\* %argc))}
+; RUN: grep {Loop %bb: backedge-taken count is (7 + (-1 \\* %argc))}
 ; XFAIL: *
 
 define i32 @main(i32 %argc, i8** %argv) nounwind {
index 9dda78b21f7d123ae7d459bb6110b96eb52ae9f6..9ee781fba77031e7683d51bf75d2953919a383ae 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -analyze -scalar-evolution -disable-output \
-; RUN:  | grep {Loop bb: Unpredictable backedge-taken count\\.}
+; RUN:  | grep {Loop %bb: Unpredictable backedge-taken count\\.}
 
 ; ScalarEvolution can't compute a trip count because it doesn't know if
 ; dividing by the stride will have a remainder. This could theoretically
index b733d6acb504075608762b2a5f83a4f2475475f3..55d3bd588e8d177534e324c83af9d0b5b3725e03 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -scalar-evolution -analyze -disable-output | grep {Loop bb3: backedge-taken count is (-1 + %n)}
+; RUN: opt < %s -scalar-evolution -analyze -disable-output | grep {Loop %bb3: backedge-taken count is (-1 + %n)}
 
 ; We don't want to use a max in the trip count expression in
 ; this testcase.
index 506401dafea5502d8b56450d8e8cf938689d1cbd..a4fdcd0b6d8308faded9b545942b1cb51eba259b 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -analyze -scalar-evolution -disable-output \
-; RUN:   | grep {\{%d,+,\[^\{\}\]\*\}<bb>}
+; RUN:   | grep {\{%d,+,\[^\{\}\]\*\}<%bb>}
 
 ; ScalarEvolution should be able to understand the loop and eliminate the casts.
 
index 1e165bf622262f9cd31bf2d35933a0d81c9be099..fd0dfe66aee65db3e83d0bf9018bc44c0ab13d4e 100644 (file)
@@ -18,11 +18,11 @@ bb:                                               ; preds = %bb.nph, %bb1
   %i.01 = phi i32 [ %16, %bb1 ], [ 0, %bb.nph ]   ; <i32> [#uses=5]
 
 ; CHECK: %1 = sext i32 %i.01 to i64
-; CHECK: -->  {0,+,2}<bb>
+; CHECK: -->  {0,+,2}<%bb>
   %1 = sext i32 %i.01 to i64                      ; <i64> [#uses=1]
 
 ; CHECK: %2 = getelementptr inbounds double* %d, i64 %1
-; CHECK: -->  {%d,+,16}<bb>
+; CHECK: -->  {%d,+,16}<%bb>
   %2 = getelementptr inbounds double* %d, i64 %1  ; <double*> [#uses=1]
 
   %3 = load double* %2, align 8                   ; <double> [#uses=1]
@@ -32,11 +32,11 @@ bb:                                               ; preds = %bb.nph, %bb1
   %7 = or i32 %i.01, 1                            ; <i32> [#uses=1]
 
 ; CHECK: %8 = sext i32 %7 to i64
-; CHECK: -->  {1,+,2}<bb>
+; CHECK: -->  {1,+,2}<%bb>
   %8 = sext i32 %7 to i64                         ; <i64> [#uses=1]
 
 ; CHECK: %9 = getelementptr inbounds double* %q, i64 %8
-; CHECK: {(8 + %q),+,16}<bb>
+; CHECK: {(8 + %q),+,16}<%bb>
   %9 = getelementptr inbounds double* %q, i64 %8  ; <double*> [#uses=1]
 
 ; Artificially repeat the above three instructions, this time using
@@ -44,11 +44,11 @@ bb:                                               ; preds = %bb.nph, %bb1
   %t7 = add nsw i32 %i.01, 1                            ; <i32> [#uses=1]
 
 ; CHECK: %t8 = sext i32 %t7 to i64
-; CHECK: -->  {1,+,2}<bb>
+; CHECK: -->  {1,+,2}<%bb>
   %t8 = sext i32 %t7 to i64                         ; <i64> [#uses=1]
 
 ; CHECK: %t9 = getelementptr inbounds double* %q, i64 %t8
-; CHECK: {(8 + %q),+,16}<bb>
+; CHECK: {(8 + %q),+,16}<%bb>
   %t9 = getelementptr inbounds double* %q, i64 %t8  ; <double*> [#uses=1]
 
   %10 = load double* %9, align 8                  ; <double> [#uses=1]
@@ -72,5 +72,5 @@ return:                                           ; preds = %bb1.return_crit_edg
   ret void
 }
 
-; CHECK: Loop bb: backedge-taken count is ((-1 + %n) /u 2)
-; CHECK: Loop bb: max backedge-taken count is 1073741823
+; CHECK: Loop %bb: backedge-taken count is ((-1 + %n) /u 2)
+; CHECK: Loop %bb: max backedge-taken count is 1073741823
index c31edabf38eeeafa3a777912d585c43b95748086..e4f2b29677c8fd25178cb84dcc584f48cdc83589 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -analyze -scalar-evolution -disable-output | grep { -->  {.*,+,.*}<bb>} | count 8
+; RUN: opt < %s -analyze -scalar-evolution -disable-output | grep { -->  {.*,+,.*}<%bb>} | count 8
 
 ; The addrecs in this loop are analyzable only by using nsw information.
 
index 16128354aeb41906f64a2637c6c8509fdba5d8ed..4487822541c2bbecf353580b34847f0cc761b1f4 100644 (file)
@@ -1,6 +1,6 @@
 ; RUN: opt < %s -analyze -scalar-evolution -disable-output > %t
-; RUN: grep {sext i57 \{0,+,199\}<bb> to i64} %t | count 1
-; RUN: grep {sext i59 \{0,+,199\}<bb> to i64} %t | count 1
+; RUN: grep {sext i57 \{0,+,199\}<%bb> to i64} %t | count 1
+; RUN: grep {sext i59 \{0,+,199\}<%bb> to i64} %t | count 1
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 target triple = "i386-apple-darwin9.6"
index 8f887c4a57eba119f21f3b209253a53c378fbc8d..05983c1ad0b39eb1ddf43f5d0f1ee9d52b96e68e 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -disable-output -scalar-evolution -analyze \
-; RUN:  | grep { -->  \{-128,+,1\}<bb1>                Exits: 127} | count 5
+; RUN:  | grep { -->  \{-128,+,1\}<%bb1>               Exits: 127} | count 5
 
 ; Convert (sext {-128,+,1}) to {sext(-128),+,sext(1)}, since the
 ; trip count is within range where this is safe.
index 02c3206c6fe76ad052ba3b96639270ef22be8787..0bf51d9ba1b5544f16a8561806dce6bec18ea332 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -disable-output -scalar-evolution -analyze \
-; RUN:  | grep { -->  (sext i. \{.\*,+,.\*\}<bb1> to i64)} | count 5
+; RUN:  | grep { -->  (sext i. \{.\*,+,.\*\}<%bb1> to i64)} | count 5
 
 ; Don't convert (sext {...,+,...}) to {sext(...),+,sext(...)} in cases
 ; where the trip count is not within range.
index b25c237958c0315c3a1b3d48056ef593865b239c..fc39cae005b6d488b4d7db21686fa54d9c97d0ae 100644 (file)
@@ -1,9 +1,9 @@
 ; RUN: opt < %s -analyze -scalar-evolution -disable-output | FileCheck %s
 
 ; CHECK: %tmp3 = sext i8 %tmp2 to i32
-; CHECK: -->  (sext i8 {0,+,1}<bb1> to i32)   Exits: -1
+; CHECK: -->  (sext i8 {0,+,1}<%bb1> to i32)   Exits: -1
 ; CHECK: %tmp4 = mul i32 %tmp3, %i.02
-; CHECK: -->  ((sext i8 {0,+,1}<bb1> to i32) * {0,+,1}<bb>)   Exits: {0,+,-1}<bb>
+; CHECK: -->  ((sext i8 {0,+,1}<%bb1> to i32) * {0,+,1}<%bb>)   Exits: {0,+,-1}<%bb>
 
 ; These sexts are not foldable.
 
index 240983178b4035c9a70f65643265ea5daf547e64..7d8e0c6d59ef90ad323bf42d0a98629cc8cbfdfa 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -scalar-evolution -analyze -disable-output \
-; RUN:  | grep {Loop bb3\\.i: Unpredictable backedge-taken count\\.}
+; RUN:  | grep {Loop %bb3\\.i: Unpredictable backedge-taken count\\.}
 
 ; ScalarEvolution can't compute a trip count because it doesn't know if
 ; dividing by the stride will have a remainder. This could theoretically
index 0cd8d7c4a9a3a8f2b2db681e70081ddffa2a84b0..74c856feea4dff19c57e67a14a2ada3e0ac026ed 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -analyze -scalar-evolution -disable-output \
-; RUN:   | grep {Loop bb7.i: Unpredictable backedge-taken count\\.}
+; RUN:   | grep {Loop %bb7.i: Unpredictable backedge-taken count\\.}
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
 
index c49f5ceea70427cff078229d6ad316cd373193ca..5063342f178b428f85568d28c7f3e846535940fa 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -analyze -scalar-evolution -disable-output \
-; RUN:  | grep {Loop for\\.body: backedge-taken count is (-1 + \[%\]ecx)}
+; RUN:  | grep {Loop %for\\.body: backedge-taken count is (-1 + \[%\]ecx)}
 ; PR4599
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
index 9ff99be736a04e18c65f9f7dcdd73fe99bbae41c..c4ac5decf3ef328ace78dfa4de97281dc42e58f3 100644 (file)
@@ -11,7 +11,7 @@ bb.i:           ; preds = %bb1.i, %bb.nph
 
 ; This cast shouldn't be folded into the addrec.
 ; CHECK: %tmp = zext i8 %l_95.0.i1 to i16
-; CHECK: -->  (zext i8 {0,+,-1}<bb.i> to i16)    Exits: 2
+; CHECK: -->  (zext i8 {0,+,-1}<%bb.i> to i16)    Exits: 2
 
         %tmp = zext i8 %l_95.0.i1 to i16
 
index 623c528487deacb12b9d744eeaf7bdff7df5349d..8003fd3671050e5084c578da0b08be3dfd1ef8ee 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt < %s -scalar-evolution -analyze -disable-output \
-; RUN:  | grep {\\-->  (zext i4 {-7,+,-8}<loop> to i32)}
+; RUN:  | grep {\\-->  (zext i4 {-7,+,-8}<%loop> to i32)}
 
 define fastcc void @foo() nounwind {
 entry:
index 2302dba913f263e087ec158bb991a01479495ff2..b829b4738bc313e5e58c4e1de6b81a420f9834ec 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -analyze -iv-users -disable-output | grep {Stride i64 {3,+,2}<loop>:}
+; RUN: opt < %s -analyze -iv-users -disable-output | grep {Stride i64 {3,+,2}<%loop>:}
 
 ; The value of %r is dependent on a polynomial iteration expression.