Index: llvm/trunk/lib/Analysis/ScalarEvolution.cpp =================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp @@ -8150,6 +8150,12 @@ OS << " --> "; const SCEV *SV = SE.getSCEV(&*I); SV->print(OS); + if (!isa(SV)) { + OS << " U: "; + SE.getUnsignedRange(SV).print(OS); + OS << " S: "; + SE.getSignedRange(SV).print(OS); + } const Loop *L = LI->getLoopFor((*I).getParent()); @@ -8157,6 +8163,12 @@ if (AtUse != SV) { OS << " --> "; AtUse->print(OS); + if (!isa(AtUse)) { + OS << " U: "; + SE.getUnsignedRange(AtUse).print(OS); + OS << " S: "; + SE.getSignedRange(AtUse).print(OS); + } } if (L) { Index: llvm/trunk/test/Analysis/ScalarEvolution/fold.ll =================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/fold.ll +++ llvm/trunk/test/Analysis/ScalarEvolution/fold.ll @@ -34,7 +34,7 @@ %rand2 = icmp ugt i32 %A, %Z1 %Z2 = select i1 %rand2, i32 %A, i32 %Z1 ; CHECK: %Z2 = -; CHECK-NEXT: --> ([[EXPR:.*]]){{ +}}Exits: 20 +; CHECK-NEXT: --> ([[EXPR:.*]]){{ U: [^ ]+ S: [^ ]+}}{{ +}}Exits: 20 %B = trunc i32 %Z2 to i16 %C = sext i16 %B to i30 ; CHECK: %C = Index: llvm/trunk/test/Analysis/ScalarEvolution/load.ll =================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/load.ll +++ llvm/trunk/test/Analysis/ScalarEvolution/load.ll @@ -14,14 +14,14 @@ for.body: ; preds = %entry, %for.body %sum.04 = phi i32 [ 0, %entry ], [ %add2, %for.body ] -; CHECK: --> %sum.04{{ *}}Exits: 2450 +; CHECK: --> %sum.04{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 2450 %i.03 = phi i32 [ 0, %entry ], [ %inc, %for.body ] %arrayidx = getelementptr inbounds [50 x i32], [50 x i32]* @arr1, i32 0, i32 %i.03 %0 = load i32, i32* %arrayidx, align 4 -; CHECK: --> %0{{ *}}Exits: 50 +; CHECK: --> %0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 50 %arrayidx1 = getelementptr inbounds [50 x i32], [50 x i32]* @arr2, i32 0, i32 %i.03 %1 = load i32, i32* %arrayidx1, align 4 -; CHECK: --> %1{{ *}}Exits: 0 +; CHECK: --> %1{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 0 %add = add i32 %0, %sum.04 %add2 = add i32 %add, %1 %inc = add nsw i32 %i.03, 1 @@ -48,15 +48,15 @@ for.body: ; preds = %entry, %for.body %sum.02 = phi i32 [ 0, %entry ], [ %add, %for.body ] -; CHECK: --> %sum.02{{ *}}Exits: 10 +; CHECK: --> %sum.02{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 10 %n.01 = phi %struct.ListNode* [ bitcast ({ %struct.ListNode*, i32, [4 x i8] }* @node5 to %struct.ListNode*), %entry ], [ %1, %for.body ] -; CHECK: --> %n.01{{ *}}Exits: @node1 +; CHECK: --> %n.01{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: @node1 %i = getelementptr inbounds %struct.ListNode, %struct.ListNode* %n.01, i64 0, i32 1 %0 = load i32, i32* %i, align 4 %add = add nsw i32 %0, %sum.02 %next = getelementptr inbounds %struct.ListNode, %struct.ListNode* %n.01, i64 0, i32 0 %1 = load %struct.ListNode*, %struct.ListNode** %next, align 8 -; CHECK: --> %1{{ *}}Exits: 0 +; CHECK: --> %1{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 0 %cmp = icmp eq %struct.ListNode* %1, null br i1 %cmp, label %for.end, label %for.body Index: llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll =================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll +++ llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll @@ -4,7 +4,7 @@ target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-p4:64:64:64-n16:32:64" -; CHECK: {%d,+,4}<%bb> Exits: ((4 * (trunc i32 (-1 + %n) to i16)) + %d) +; CHECK: {%d,+,4}<%bb>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: ((4 * (trunc i32 (-1 + %n) to i16)) + %d) define void @foo(i32 addrspace(1)* nocapture %d, i32 %n) nounwind { Index: llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll =================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll +++ llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll @@ -124,7 +124,7 @@ } ; CHECK-LABEL: PR12375 -; CHECK: --> {(4 + %arg),+,4}<%bb1> Exits: (8 + %arg) +; CHECK: --> {(4 + %arg),+,4}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (8 + %arg) define i32 @PR12375(i32* readnone %arg) { bb: %tmp = getelementptr inbounds i32, i32* %arg, i64 2 @@ -143,7 +143,7 @@ } ; CHECK-LABEL: PR12376 -; CHECK: --> {(4 + %arg),+,4}<%bb2> Exits: (4 + (4 * ((3 + (-1 * %arg) + (%arg umax %arg1)) /u 4)) + %arg) +; CHECK: --> {(4 + %arg),+,4}<%bb2>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((3 + (-1 * %arg) + (%arg umax %arg1)) /u 4)) + %arg) define void @PR12376(i32* nocapture %arg, i32* nocapture %arg1) { bb: br label %bb2 @@ -161,7 +161,7 @@ declare void @f(i32) ; CHECK-LABEL: nswnowrap -; CHECK: --> {(1 + %v),+,1}<%for.body> Exits: (2 + %v) +; CHECK: --> {(1 + %v),+,1}<%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (2 + %v) define void @nswnowrap(i32 %v) { entry: %add = add nsw i32 %v, 1 Index: llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-0.ll =================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-0.ll +++ llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-0.ll @@ -13,16 +13,16 @@ bb1: ; preds = %bb1, %bb1.thread %i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ] ; [#uses=3] ; CHECK: %i.0.reg2mem.0 -; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127 +; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127 %0 = trunc i64 %i.0.reg2mem.0 to i8 ; [#uses=1] ; CHECK: %0 -; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127 +; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127 %1 = trunc i64 %i.0.reg2mem.0 to i9 ; [#uses=1] ; CHECK: %1 -; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127 +; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127 %2 = sext i9 %1 to i64 ; [#uses=1] ; CHECK: %2 -; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127 +; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127 %3 = getelementptr double, double* %x, i64 %2 ; [#uses=1] %4 = load double, double* %3, align 8 ; [#uses=1] %5 = fmul double %4, 3.900000e+00 ; [#uses=1] Index: llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-2.ll =================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-2.ll +++ llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-2.ll @@ -1,9 +1,9 @@ ; RUN: opt < %s -analyze -scalar-evolution | 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){{ U: [^ ]+ S: [^ ]+}}{{ *}}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>){{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: {0,+,-1}<%bb> ; These sexts are not foldable. Index: llvm/trunk/test/Analysis/ScalarEvolution/trip-count11.ll =================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/trip-count11.ll +++ llvm/trunk/test/Analysis/ScalarEvolution/trip-count11.ll @@ -13,7 +13,7 @@ for.cond: ; preds = %for.inc, %entry %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ] -; CHECK: --> %sum.0 Exits: 28 +; CHECK: --> %sum.0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 28 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] %cmp = icmp ult i32 %i.0, 8 br i1 %cmp, label %for.inc, label %for.end @@ -36,7 +36,7 @@ for.cond: ; preds = %for.inc, %entry %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ] -; CHECK: --> %sum.0 Exits: 28 +; CHECK: --> %sum.0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 28 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] %cmp = icmp ult i32 %i.0, 8 br i1 %cmp, label %for.inc, label %for.end Index: llvm/trunk/test/Analysis/ScalarEvolution/zext-wrap.ll =================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/zext-wrap.ll +++ llvm/trunk/test/Analysis/ScalarEvolution/zext-wrap.ll @@ -10,7 +10,7 @@ ; 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){{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 2 %tmp = zext i8 %l_95.0.i1 to i16