[llvm] r231708 - [SCEV] Add a `scalar-evolution-print-constant-ranges' option
Sanjoy Das
sanjoy at playingwithpointers.com
Mon Mar 9 14:57:44 PDT 2015
I accidentally checked this in with a stale commit message. The
version of the change that was checked in does not actually add any
command line options, but teaches ScalarEvolution::print to
unconditionally print the constant ranges for the SCEV values it
prints.
On Mon, Mar 9, 2015 at 2:43 PM, Sanjoy Das
<sanjoy at playingwithpointers.com> wrote:
> Author: sanjoy
> Date: Mon Mar 9 16:43:39 2015
> New Revision: 231708
>
> URL: http://llvm.org/viewvc/llvm-project?rev=231708&view=rev
> Log:
> [SCEV] Add a `scalar-evolution-print-constant-ranges' option
>
> Summary:
> Unused in this commit, but will be used in a subsequent change (D8142)
> by a FileCheck test.
>
> Reviewers: atrick
>
> Subscribers: llvm-commits
>
> Differential Revision: http://reviews.llvm.org/D8143
>
> Modified:
> llvm/trunk/lib/Analysis/ScalarEvolution.cpp
> llvm/trunk/test/Analysis/ScalarEvolution/fold.ll
> llvm/trunk/test/Analysis/ScalarEvolution/load.ll
> llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll
> llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll
> llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-0.ll
> llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-2.ll
> llvm/trunk/test/Analysis/ScalarEvolution/trip-count11.ll
> llvm/trunk/test/Analysis/ScalarEvolution/zext-wrap.ll
>
> Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=231708&r1=231707&r2=231708&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Mar 9 16:43:39 2015
> @@ -8150,6 +8150,12 @@ void ScalarEvolution::print(raw_ostream
> OS << " --> ";
> const SCEV *SV = SE.getSCEV(&*I);
> SV->print(OS);
> + if (!isa<SCEVCouldNotCompute>(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 @@ void ScalarEvolution::print(raw_ostream
> if (AtUse != SV) {
> OS << " --> ";
> AtUse->print(OS);
> + if (!isa<SCEVCouldNotCompute>(AtUse)) {
> + OS << " U: ";
> + SE.getUnsignedRange(AtUse).print(OS);
> + OS << " S: ";
> + SE.getSignedRange(AtUse).print(OS);
> + }
> }
>
> if (L) {
>
> Modified: llvm/trunk/test/Analysis/ScalarEvolution/fold.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/fold.ll?rev=231708&r1=231707&r2=231708&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/ScalarEvolution/fold.ll (original)
> +++ llvm/trunk/test/Analysis/ScalarEvolution/fold.ll Mon Mar 9 16:43:39 2015
> @@ -34,7 +34,7 @@ loop:
> %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 =
>
> Modified: llvm/trunk/test/Analysis/ScalarEvolution/load.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/load.ll?rev=231708&r1=231707&r2=231708&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/ScalarEvolution/load.ll (original)
> +++ llvm/trunk/test/Analysis/ScalarEvolution/load.ll Mon Mar 9 16:43:39 2015
> @@ -14,14 +14,14 @@ entry:
>
> 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 @@ entry:
>
> 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
>
>
> Modified: llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll?rev=231708&r1=231707&r2=231708&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll (original)
> +++ llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll Mon Mar 9 16:43:39 2015
> @@ -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 {
>
> Modified: llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll?rev=231708&r1=231707&r2=231708&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll (original)
> +++ llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll Mon Mar 9 16:43:39 2015
> @@ -124,7 +124,7 @@ exit:
> }
>
> ; CHECK-LABEL: PR12375
> -; CHECK: --> {(4 + %arg),+,4}<nuw><%bb1> Exits: (8 + %arg)<nsw>
> +; CHECK: --> {(4 + %arg),+,4}<nuw><%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (8 + %arg)<nsw>
> define i32 @PR12375(i32* readnone %arg) {
> bb:
> %tmp = getelementptr inbounds i32, i32* %arg, i64 2
> @@ -143,7 +143,7 @@ bb7:
> }
>
> ; CHECK-LABEL: PR12376
> -; CHECK: --> {(4 + %arg),+,4}<nuw><%bb2> Exits: (4 + (4 * ((3 + (-1 * %arg) + (%arg umax %arg1)) /u 4)) + %arg)
> +; CHECK: --> {(4 + %arg),+,4}<nuw><%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 @@ bb5:
> declare void @f(i32)
>
> ; CHECK-LABEL: nswnowrap
> -; CHECK: --> {(1 + %v),+,1}<nsw><%for.body> Exits: (2 + %v)
> +; CHECK: --> {(1 + %v),+,1}<nsw><%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (2 + %v)
> define void @nswnowrap(i32 %v) {
> entry:
> %add = add nsw i32 %v, 1
>
> Modified: llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-0.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-0.ll?rev=231708&r1=231707&r2=231708&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-0.ll (original)
> +++ llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-0.ll Mon Mar 9 16:43:39 2015
> @@ -13,16 +13,16 @@ bb1.thread:
> bb1: ; preds = %bb1, %bb1.thread
> %i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ] ; <i64> [#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 ; <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 ; <i8> [#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 ; <i64> [#uses=1]
> ; CHECK: %2
> -; CHECK-NEXT: --> {-128,+,1}<nsw><%bb1> Exits: 127
> +; CHECK-NEXT: --> {-128,+,1}<nsw><%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127
> %3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1]
> %4 = load double, double* %3, align 8 ; <double> [#uses=1]
> %5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1]
>
> Modified: llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-2.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-2.ll?rev=231708&r1=231707&r2=231708&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-2.ll (original)
> +++ llvm/trunk/test/Analysis/ScalarEvolution/sext-iv-2.ll Mon Mar 9 16:43:39 2015
> @@ -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.
>
>
> Modified: llvm/trunk/test/Analysis/ScalarEvolution/trip-count11.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/trip-count11.ll?rev=231708&r1=231707&r2=231708&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/ScalarEvolution/trip-count11.ll (original)
> +++ llvm/trunk/test/Analysis/ScalarEvolution/trip-count11.ll Mon Mar 9 16:43:39 2015
> @@ -13,7 +13,7 @@ entry:
>
> 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 @@ entry:
>
> 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
>
> Modified: llvm/trunk/test/Analysis/ScalarEvolution/zext-wrap.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/zext-wrap.ll?rev=231708&r1=231707&r2=231708&view=diff
> ==============================================================================
> --- llvm/trunk/test/Analysis/ScalarEvolution/zext-wrap.ll (original)
> +++ llvm/trunk/test/Analysis/ScalarEvolution/zext-wrap.ll Mon Mar 9 16:43:39 2015
> @@ -10,7 +10,7 @@ bb.i: ; preds = %bb1.i, %bb.np
>
> ; 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
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list