llvm.org GIT mirror llvm / afeb9bf
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231708 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjoy Das 5 years ago
9 changed file(s) with 32 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
81498149 OS << " --> ";
81508150 const SCEV *SV = SE.getSCEV(&*I);
81518151 SV->print(OS);
8152 if (!isa(SV)) {
8153 OS << " U: ";
8154 SE.getUnsignedRange(SV).print(OS);
8155 OS << " S: ";
8156 SE.getSignedRange(SV).print(OS);
8157 }
81528158
81538159 const Loop *L = LI->getLoopFor((*I).getParent());
81548160
81568162 if (AtUse != SV) {
81578163 OS << " --> ";
81588164 AtUse->print(OS);
8165 if (!isa(AtUse)) {
8166 OS << " U: ";
8167 SE.getUnsignedRange(AtUse).print(OS);
8168 OS << " S: ";
8169 SE.getSignedRange(AtUse).print(OS);
8170 }
81598171 }
81608172
81618173 if (L) {
3333 %rand2 = icmp ugt i32 %A, %Z1
3434 %Z2 = select i1 %rand2, i32 %A, i32 %Z1
3535 ; CHECK: %Z2 =
36 ; CHECK-NEXT: --> ([[EXPR:.*]]){{ +}}Exits: 20
36 ; CHECK-NEXT: --> ([[EXPR:.*]]){{ U: [^ ]+ S: [^ ]+}}{{ +}}Exits: 20
3737 %B = trunc i32 %Z2 to i16
3838 %C = sext i16 %B to i30
3939 ; CHECK: %C =
1313
1414 for.body: ; preds = %entry, %for.body
1515 %sum.04 = phi i32 [ 0, %entry ], [ %add2, %for.body ]
16 ; CHECK: --> %sum.04{{ *}}Exits: 2450
16 ; CHECK: --> %sum.04{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 2450
1717 %i.03 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
1818 %arrayidx = getelementptr inbounds [50 x i32], [50 x i32]* @arr1, i32 0, i32 %i.03
1919 %0 = load i32, i32* %arrayidx, align 4
20 ; CHECK: --> %0{{ *}}Exits: 50
20 ; CHECK: --> %0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 50
2121 %arrayidx1 = getelementptr inbounds [50 x i32], [50 x i32]* @arr2, i32 0, i32 %i.03
2222 %1 = load i32, i32* %arrayidx1, align 4
23 ; CHECK: --> %1{{ *}}Exits: 0
23 ; CHECK: --> %1{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 0
2424 %add = add i32 %0, %sum.04
2525 %add2 = add i32 %add, %1
2626 %inc = add nsw i32 %i.03, 1
4747
4848 for.body: ; preds = %entry, %for.body
4949 %sum.02 = phi i32 [ 0, %entry ], [ %add, %for.body ]
50 ; CHECK: --> %sum.02{{ *}}Exits: 10
50 ; CHECK: --> %sum.02{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 10
5151 %n.01 = phi %struct.ListNode* [ bitcast ({ %struct.ListNode*, i32, [4 x i8] }* @node5 to %struct.ListNode*), %entry ], [ %1, %for.body ]
52 ; CHECK: --> %n.01{{ *}}Exits: @node1
52 ; CHECK: --> %n.01{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: @node1
5353 %i = getelementptr inbounds %struct.ListNode, %struct.ListNode* %n.01, i64 0, i32 1
5454 %0 = load i32, i32* %i, align 4
5555 %add = add nsw i32 %0, %sum.02
5656 %next = getelementptr inbounds %struct.ListNode, %struct.ListNode* %n.01, i64 0, i32 0
5757 %1 = load %struct.ListNode*, %struct.ListNode** %next, align 8
58 ; CHECK: --> %1{{ *}}Exits: 0
58 ; CHECK: --> %1{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 0
5959 %cmp = icmp eq %struct.ListNode* %1, null
6060 br i1 %cmp, label %for.end, label %for.body
6161
33
44 target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-p4:64:64:64-n16:32:64"
55
6 ; CHECK: {%d,+,4}<%bb> Exits: ((4 * (trunc i32 (-1 + %n) to i16)) + %d)
6 ; CHECK: {%d,+,4}<%bb>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: ((4 * (trunc i32 (-1 + %n) to i16)) + %d)
77
88
99 define void @foo(i32 addrspace(1)* nocapture %d, i32 %n) nounwind {
123123 }
124124
125125 ; CHECK-LABEL: PR12375
126 ; CHECK: --> {(4 + %arg),+,4}<%bb1> Exits: (8 + %arg)
126 ; CHECK: --> {(4 + %arg),+,4}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (8 + %arg)
127127 define i32 @PR12375(i32* readnone %arg) {
128128 bb:
129129 %tmp = getelementptr inbounds i32, i32* %arg, i64 2
142142 }
143143
144144 ; CHECK-LABEL: PR12376
145 ; CHECK: --> {(4 + %arg),+,4}<%bb2> Exits: (4 + (4 * ((3 + (-1 * %arg) + (%arg umax %arg1)) /u 4)) + %arg)
145 ; CHECK: --> {(4 + %arg),+,4}<%bb2>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((3 + (-1 * %arg) + (%arg umax %arg1)) /u 4)) + %arg)
146146 define void @PR12376(i32* nocapture %arg, i32* nocapture %arg1) {
147147 bb:
148148 br label %bb2
160160 declare void @f(i32)
161161
162162 ; CHECK-LABEL: nswnowrap
163 ; CHECK: --> {(1 + %v),+,1}<%for.body> Exits: (2 + %v)
163 ; CHECK: --> {(1 + %v),+,1}<%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (2 + %v)
164164 define void @nswnowrap(i32 %v) {
165165 entry:
166166 %add = add nsw i32 %v, 1
1212 bb1: ; preds = %bb1, %bb1.thread
1313 %i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ] ; [#uses=3]
1414 ; CHECK: %i.0.reg2mem.0
15 ; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127
15 ; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127
1616 %0 = trunc i64 %i.0.reg2mem.0 to i8 ; [#uses=1]
1717 ; CHECK: %0
18 ; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127
18 ; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127
1919 %1 = trunc i64 %i.0.reg2mem.0 to i9 ; [#uses=1]
2020 ; CHECK: %1
21 ; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127
21 ; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127
2222 %2 = sext i9 %1 to i64 ; [#uses=1]
2323 ; CHECK: %2
24 ; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127
24 ; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127
2525 %3 = getelementptr double, double* %x, i64 %2 ; [#uses=1]
2626 %4 = load double, double* %3, align 8 ; [#uses=1]
2727 %5 = fmul double %4, 3.900000e+00 ; [#uses=1]
0 ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
11
22 ; CHECK: %tmp3 = sext i8 %tmp2 to i32
3 ; CHECK: --> (sext i8 {0,+,1}<%bb1> to i32) Exits: -1
3 ; CHECK: --> (sext i8 {0,+,1}<%bb1> to i32){{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: -1
44 ; CHECK: %tmp4 = mul i32 %tmp3, %i.02
5 ; CHECK: --> ((sext i8 {0,+,1}<%bb1> to i32) * {0,+,1}<%bb>) Exits: {0,+,-1}<%bb>
5 ; CHECK: --> ((sext i8 {0,+,1}<%bb1> to i32) * {0,+,1}<%bb>){{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: {0,+,-1}<%bb>
66
77 ; These sexts are not foldable.
88
1212
1313 for.cond: ; preds = %for.inc, %entry
1414 %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ]
15 ; CHECK: --> %sum.0 Exits: 28
15 ; CHECK: --> %sum.0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 28
1616 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
1717 %cmp = icmp ult i32 %i.0, 8
1818 br i1 %cmp, label %for.inc, label %for.end
3535
3636 for.cond: ; preds = %for.inc, %entry
3737 %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ]
38 ; CHECK: --> %sum.0 Exits: 28
38 ; CHECK: --> %sum.0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 28
3939 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
4040 %cmp = icmp ult i32 %i.0, 8
4141 br i1 %cmp, label %for.inc, label %for.end
99
1010 ; This cast shouldn't be folded into the addrec.
1111 ; CHECK: %tmp = zext i8 %l_95.0.i1 to i16
12 ; CHECK: --> (zext i8 {0,+,-1}<%bb.i> to i16) Exits: 2
12 ; CHECK: --> (zext i8 {0,+,-1}<%bb.i> to i16){{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 2
1313
1414 %tmp = zext i8 %l_95.0.i1 to i16
1515