1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s
4 define void @f0(i1 %c) {
6 ; CHECK-NEXT: Classifying expressions for: @f0
7 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0
8 ; CHECK-NEXT: --> %start U: [0,128) S: [0,128)
9 ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1
10 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2)
11 ; CHECK-NEXT: %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ]
12 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,128) S: [0,128) Exits: 127 LoopDispositions: { %loop: Computable }
13 ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
14 ; CHECK-NEXT: --> {%start,+,%step}<nsw><%loop> U: [0,128) S: [0,128) Exits: ((127 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
15 ; CHECK-NEXT: %iv.next = add i32 %iv, %step
16 ; CHECK-NEXT: --> {(%step + %start),+,%step}<nw><%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
17 ; CHECK-NEXT: %loop.iv.inc = add i32 %loop.iv, 1
18 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable }
19 ; CHECK-NEXT: Determining loop execution counts for: @f0
20 ; CHECK-NEXT: Loop %loop: backedge-taken count is 127
21 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 127
22 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127
23 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127
24 ; CHECK-NEXT: Predicates:
25 ; CHECK-NEXT: Loop %loop: Trip multiple is 128
28 %start = select i1 %c, i32 127, i32 0
29 %step = select i1 %c, i32 -1, i32 1
33 %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ]
34 %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
35 %iv.next = add i32 %iv, %step
36 %loop.iv.inc = add i32 %loop.iv, 1
37 %be.cond = icmp ne i32 %loop.iv.inc, 128
38 br i1 %be.cond, label %loop, label %leave
44 define void @f1(i1 %c) {
46 ; CHECK-NEXT: Classifying expressions for: @f1
47 ; CHECK-NEXT: %start = select i1 %c, i32 120, i32 0
48 ; CHECK-NEXT: --> %start U: [0,121) S: [0,121)
49 ; CHECK-NEXT: %step = select i1 %c, i32 -8, i32 8
50 ; CHECK-NEXT: --> %step U: [8,-7) S: [-16,16)
51 ; CHECK-NEXT: %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ]
52 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,16) S: [0,16) Exits: 15 LoopDispositions: { %loop: Computable }
53 ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
54 ; CHECK-NEXT: --> {%start,+,%step}<nsw><%loop> U: [0,121) S: [0,121) Exits: ((15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
55 ; CHECK-NEXT: %iv.1 = add i32 %iv, 1
56 ; CHECK-NEXT: --> {(1 + %start)<nuw><nsw>,+,%step}<nsw><%loop> U: [1,122) S: [1,122) Exits: (1 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
57 ; CHECK-NEXT: %iv.2 = add i32 %iv, 2
58 ; CHECK-NEXT: --> {(2 + %start)<nuw><nsw>,+,%step}<nsw><%loop> U: [2,123) S: [2,123) Exits: (2 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
59 ; CHECK-NEXT: %iv.3 = add i32 %iv, 3
60 ; CHECK-NEXT: --> {(3 + %start)<nuw><nsw>,+,%step}<nsw><%loop> U: [3,124) S: [3,124) Exits: (3 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
61 ; CHECK-NEXT: %iv.4 = add i32 %iv, 4
62 ; CHECK-NEXT: --> {(4 + %start)<nuw><nsw>,+,%step}<nsw><%loop> U: [4,125) S: [4,125) Exits: (4 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
63 ; CHECK-NEXT: %iv.5 = add i32 %iv, 5
64 ; CHECK-NEXT: --> {(5 + %start)<nuw><nsw>,+,%step}<nsw><%loop> U: [5,126) S: [5,126) Exits: (5 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
65 ; CHECK-NEXT: %iv.6 = add i32 %iv, 6
66 ; CHECK-NEXT: --> {(6 + %start)<nuw><nsw>,+,%step}<nsw><%loop> U: [6,127) S: [6,127) Exits: (6 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
67 ; CHECK-NEXT: %iv.7 = add i32 %iv, 7
68 ; CHECK-NEXT: --> {(7 + %start)<nuw><nsw>,+,%step}<nsw><%loop> U: [7,128) S: [7,128) Exits: (7 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
69 ; CHECK-NEXT: %iv.m1 = sub i32 %iv, 1
70 ; CHECK-NEXT: --> {(-1 + %start)<nsw>,+,%step}<nsw><%loop> U: [-1,120) S: [-1,120) Exits: (-1 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
71 ; CHECK-NEXT: %iv.m2 = sub i32 %iv, 2
72 ; CHECK-NEXT: --> {(-2 + %start)<nsw>,+,%step}<nsw><%loop> U: [0,-1) S: [-2,119) Exits: (-2 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
73 ; CHECK-NEXT: %iv.m3 = sub i32 %iv, 3
74 ; CHECK-NEXT: --> {(-3 + %start)<nsw>,+,%step}<nsw><%loop> U: [-3,118) S: [-3,118) Exits: (-3 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
75 ; CHECK-NEXT: %iv.m4 = sub i32 %iv, 4
76 ; CHECK-NEXT: --> {(-4 + %start)<nsw>,+,%step}<nsw><%loop> U: [0,-3) S: [-4,117) Exits: (-4 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
77 ; CHECK-NEXT: %iv.m5 = sub i32 %iv, 5
78 ; CHECK-NEXT: --> {(-5 + %start)<nsw>,+,%step}<nsw><%loop> U: [-5,116) S: [-5,116) Exits: (-5 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
79 ; CHECK-NEXT: %iv.m6 = sub i32 %iv, 6
80 ; CHECK-NEXT: --> {(-6 + %start)<nsw>,+,%step}<nsw><%loop> U: [0,-1) S: [-6,115) Exits: (-6 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
81 ; CHECK-NEXT: %iv.m7 = sub i32 %iv, 7
82 ; CHECK-NEXT: --> {(-7 + %start)<nsw>,+,%step}<nsw><%loop> U: [-7,114) S: [-7,114) Exits: (-7 + (15 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
83 ; CHECK-NEXT: %iv.next = add i32 %iv, %step
84 ; CHECK-NEXT: --> {(%step + %start),+,%step}<nw><%loop> U: [0,-7) S: [-256,361) Exits: ((16 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
85 ; CHECK-NEXT: %loop.iv.inc = add i32 %loop.iv, 1
86 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,17) S: [1,17) Exits: 16 LoopDispositions: { %loop: Computable }
87 ; CHECK-NEXT: Determining loop execution counts for: @f1
88 ; CHECK-NEXT: Loop %loop: backedge-taken count is 15
89 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 15
90 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 15
91 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 15
92 ; CHECK-NEXT: Predicates:
93 ; CHECK-NEXT: Loop %loop: Trip multiple is 16
96 %start = select i1 %c, i32 120, i32 0
97 %step = select i1 %c, i32 -8, i32 8
101 %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ]
102 %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
105 %iv.1 = add i32 %iv, 1
106 %iv.2 = add i32 %iv, 2
107 %iv.3 = add i32 %iv, 3
108 %iv.4 = add i32 %iv, 4
109 %iv.5 = add i32 %iv, 5
110 %iv.6 = add i32 %iv, 6
111 %iv.7 = add i32 %iv, 7
114 %iv.m1 = sub i32 %iv, 1
115 %iv.m2 = sub i32 %iv, 2
116 %iv.m3 = sub i32 %iv, 3
117 %iv.m4 = sub i32 %iv, 4
118 %iv.m5 = sub i32 %iv, 5
119 %iv.m6 = sub i32 %iv, 6
120 %iv.m7 = sub i32 %iv, 7
122 %iv.next = add i32 %iv, %step
123 %loop.iv.inc = add i32 %loop.iv, 1
124 %be.cond = icmp sgt i32 %loop.iv, 14
125 br i1 %be.cond, label %leave, label %loop
131 define void @f2(i1 %c) {
133 ; CHECK-NEXT: Classifying expressions for: @f2
134 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0
135 ; CHECK-NEXT: --> %start U: [0,128) S: [0,128)
136 ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1
137 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2)
138 ; CHECK-NEXT: %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ]
139 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,128) S: [0,128) Exits: 127 LoopDispositions: { %loop: Computable }
140 ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
141 ; CHECK-NEXT: --> {%start,+,%step}<nsw><%loop> U: [0,128) S: [0,128) Exits: ((127 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
142 ; CHECK-NEXT: %iv.sext = sext i32 %iv to i64
143 ; CHECK-NEXT: --> {(zext i32 %start to i64),+,(sext i32 %step to i64)}<nsw><%loop> U: [0,128) S: [0,128) Exits: ((zext i32 %start to i64) + (127 * (sext i32 %step to i64))<nsw>) LoopDispositions: { %loop: Computable }
144 ; CHECK-NEXT: %iv.next = add i32 %iv, %step
145 ; CHECK-NEXT: --> {(%step + %start),+,%step}<nw><%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
146 ; CHECK-NEXT: %loop.iv.inc = add i32 %loop.iv, 1
147 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable }
148 ; CHECK-NEXT: Determining loop execution counts for: @f2
149 ; CHECK-NEXT: Loop %loop: backedge-taken count is 127
150 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 127
151 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127
152 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127
153 ; CHECK-NEXT: Predicates:
154 ; CHECK-NEXT: Loop %loop: Trip multiple is 128
157 %start = select i1 %c, i32 127, i32 0
158 %step = select i1 %c, i32 -1, i32 1
162 %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ]
163 %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
164 %iv.sext = sext i32 %iv to i64
165 %iv.next = add i32 %iv, %step
166 %loop.iv.inc = add i32 %loop.iv, 1
167 %be.cond = icmp ne i32 %loop.iv.inc, 128
168 br i1 %be.cond, label %loop, label %leave
174 define void @f3(i1 %c) {
176 ; CHECK-NEXT: Classifying expressions for: @f3
177 ; CHECK-NEXT: %start = select i1 %c, i16 1000, i16 0
178 ; CHECK-NEXT: --> %start U: [0,1001) S: [0,1001)
179 ; CHECK-NEXT: %step = select i1 %c, i16 1, i16 509
180 ; CHECK-NEXT: --> %step U: [1,510) S: [1,510)
181 ; CHECK-NEXT: %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ]
182 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,128) S: [0,128) Exits: 127 LoopDispositions: { %loop: Computable }
183 ; CHECK-NEXT: %iv = phi i16 [ %start, %entry ], [ %iv.next, %loop ]
184 ; CHECK-NEXT: --> {%start,+,%step}<nuw><%loop> U: [0,-892) S: [0,-892) Exits: ((127 * %step)<nuw> + %start) LoopDispositions: { %loop: Computable }
185 ; CHECK-NEXT: %iv.zext = zext i16 %iv to i64
186 ; CHECK-NEXT: --> {(zext i16 %start to i64),+,(zext i16 %step to i64)}<nuw><%loop> U: [0,64644) S: [0,64644) Exits: ((zext i16 %start to i64) + (127 * (zext i16 %step to i64))<nuw><nsw>) LoopDispositions: { %loop: Computable }
187 ; CHECK-NEXT: %iv.next = add i16 %iv, %step
188 ; CHECK-NEXT: --> {(%step + %start),+,%step}<nw><%loop> U: full-set S: full-set Exits: ((128 * %step)<nuw> + %start) LoopDispositions: { %loop: Computable }
189 ; CHECK-NEXT: %loop.iv.inc = add i16 %loop.iv, 1
190 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable }
191 ; CHECK-NEXT: Determining loop execution counts for: @f3
192 ; CHECK-NEXT: Loop %loop: backedge-taken count is 127
193 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 127
194 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127
195 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127
196 ; CHECK-NEXT: Predicates:
197 ; CHECK-NEXT: Loop %loop: Trip multiple is 128
201 ; NB! the i16 type (as opposed to i32), the choice of the constant 509
202 ; and the trip count are all related and not arbitrary. We want an
203 ; add recurrence that will look like it can unsign-overflow *unless*
204 ; SCEV is able to see the correlation between the two selects feeding
205 ; into the initial value and the step increment.
207 %start = select i1 %c, i16 1000, i16 0
208 %step = select i1 %c, i16 1, i16 509
212 %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ]
213 %iv = phi i16 [ %start, %entry ], [ %iv.next, %loop ]
214 %iv.zext = zext i16 %iv to i64
215 %iv.next = add i16 %iv, %step
216 %loop.iv.inc = add i16 %loop.iv, 1
217 %be.cond = icmp ne i16 %loop.iv.inc, 128
218 br i1 %be.cond, label %loop, label %leave
224 define void @f4(i1 %c) {
226 ; CHECK-NEXT: Classifying expressions for: @f4
227 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0
228 ; CHECK-NEXT: --> %start U: [0,128) S: [0,128)
229 ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1
230 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2)
231 ; CHECK-NEXT: %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ]
232 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,128) S: [0,128) Exits: 127 LoopDispositions: { %loop: Computable }
233 ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
234 ; CHECK-NEXT: --> {%start,+,%step}<nsw><%loop> U: [0,128) S: [0,128) Exits: ((127 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
235 ; CHECK-NEXT: %iv.trunc = trunc i32 %iv to i16
236 ; CHECK-NEXT: --> {(trunc i32 %start to i16),+,(trunc i32 %step to i16)}<%loop> U: [0,128) S: [0,128) Exits: ((trunc i32 %start to i16) + (127 * (trunc i32 %step to i16))<nsw>) LoopDispositions: { %loop: Computable }
237 ; CHECK-NEXT: %iv.next = add i32 %iv, %step
238 ; CHECK-NEXT: --> {(%step + %start),+,%step}<nw><%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
239 ; CHECK-NEXT: %loop.iv.inc = add i32 %loop.iv, 1
240 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable }
241 ; CHECK-NEXT: Determining loop execution counts for: @f4
242 ; CHECK-NEXT: Loop %loop: backedge-taken count is 127
243 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 127
244 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127
245 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127
246 ; CHECK-NEXT: Predicates:
247 ; CHECK-NEXT: Loop %loop: Trip multiple is 128
251 %start = select i1 %c, i32 127, i32 0
252 %step = select i1 %c, i32 -1, i32 1
256 %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ]
257 %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
258 %iv.trunc = trunc i32 %iv to i16
259 %iv.next = add i32 %iv, %step
260 %loop.iv.inc = add i32 %loop.iv, 1
261 %be.cond = icmp ne i32 %loop.iv.inc, 128
262 br i1 %be.cond, label %loop, label %leave
268 define void @f5(i1 %c) {
270 ; CHECK-NEXT: Classifying expressions for: @f5
271 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0
272 ; CHECK-NEXT: --> %start U: [0,128) S: [0,128)
273 ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1
274 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2)
275 ; CHECK-NEXT: %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ]
276 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,128) S: [0,128) Exits: 127 LoopDispositions: { %loop: Computable }
277 ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
278 ; CHECK-NEXT: --> {%start,+,%step}<nsw><%loop> U: [0,128) S: [0,128) Exits: ((127 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
279 ; CHECK-NEXT: %iv.trunc = trunc i32 %iv to i16
280 ; CHECK-NEXT: --> {(trunc i32 %start to i16),+,(trunc i32 %step to i16)}<%loop> U: [0,128) S: [0,128) Exits: ((trunc i32 %start to i16) + (127 * (trunc i32 %step to i16))<nsw>) LoopDispositions: { %loop: Computable }
281 ; CHECK-NEXT: %iv.next = add i32 %iv, %step
282 ; CHECK-NEXT: --> {(%step + %start),+,%step}<nw><%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
283 ; CHECK-NEXT: %loop.iv.inc = add i16 %loop.iv, 1
284 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable }
285 ; CHECK-NEXT: Determining loop execution counts for: @f5
286 ; CHECK-NEXT: Loop %loop: backedge-taken count is 127
287 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 127
288 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127
289 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127
290 ; CHECK-NEXT: Predicates:
291 ; CHECK-NEXT: Loop %loop: Trip multiple is 128
294 %start = select i1 %c, i32 127, i32 0
295 %step = select i1 %c, i32 -1, i32 1
299 %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ]
300 %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
301 %iv.trunc = trunc i32 %iv to i16
302 %iv.next = add i32 %iv, %step
304 %loop.iv.inc = add i16 %loop.iv, 1
305 %be.cond = icmp ne i16 %loop.iv.inc, 128
306 br i1 %be.cond, label %loop, label %leave
312 define void @f6(i1 %c) {
314 ; CHECK-NEXT: Classifying expressions for: @f6
315 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0
316 ; CHECK-NEXT: --> %start U: [0,128) S: [0,128)
317 ; CHECK-NEXT: %step = select i1 %c, i32 -2, i32 0
318 ; CHECK-NEXT: --> %step U: [0,-1) S: [-2,2)
319 ; CHECK-NEXT: %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ]
320 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,128) S: [0,128) Exits: 127 LoopDispositions: { %loop: Computable }
321 ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
322 ; CHECK-NEXT: --> {%start,+,(1 + %step)<nuw><nsw>}<nsw><%loop> U: [0,128) S: [0,128) Exits: (127 + (127 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
323 ; CHECK-NEXT: %step.plus.one = add i32 %step, 1
324 ; CHECK-NEXT: --> (1 + %step)<nuw><nsw> U: [1,0) S: [-1,3) Exits: (1 + %step)<nuw><nsw> LoopDispositions: { %loop: Invariant }
325 ; CHECK-NEXT: %iv.next = add i32 %iv, %step.plus.one
326 ; CHECK-NEXT: --> {(1 + %step + %start),+,(1 + %step)<nuw><nsw>}<nw><%loop> U: [-128,384) S: [-128,384) Exits: (128 + (128 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
327 ; CHECK-NEXT: %iv.sext = sext i32 %iv to i64
328 ; CHECK-NEXT: --> {(zext i32 %start to i64),+,(1 + (sext i32 %step to i64))<nuw><nsw>}<nsw><%loop> U: [0,128) S: [0,128) Exits: (127 + (zext i32 %start to i64) + (127 * (sext i32 %step to i64))<nsw>) LoopDispositions: { %loop: Computable }
329 ; CHECK-NEXT: %loop.iv.inc = add i16 %loop.iv, 1
330 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable }
331 ; CHECK-NEXT: Determining loop execution counts for: @f6
332 ; CHECK-NEXT: Loop %loop: backedge-taken count is 127
333 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 127
334 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127
335 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127
336 ; CHECK-NEXT: Predicates:
337 ; CHECK-NEXT: Loop %loop: Trip multiple is 128
340 %start = select i1 %c, i32 127, i32 0
341 %step = select i1 %c, i32 -2, i32 0
345 %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ]
346 %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
348 %step.plus.one = add i32 %step, 1
349 %iv.next = add i32 %iv, %step.plus.one
350 %iv.sext = sext i32 %iv to i64
351 %loop.iv.inc = add i16 %loop.iv, 1
352 %be.cond = icmp ne i16 %loop.iv.inc, 128
353 br i1 %be.cond, label %loop, label %leave
359 define void @f7(i1 %c) {
361 ; CHECK-NEXT: Classifying expressions for: @f7
362 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0
363 ; CHECK-NEXT: --> %start U: [0,128) S: [0,128)
364 ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1
365 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2)
366 ; CHECK-NEXT: %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ]
367 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,128) S: [0,128) Exits: 127 LoopDispositions: { %loop: Computable }
368 ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
369 ; CHECK-NEXT: --> {%start,+,%step}<nsw><%loop> U: [0,128) S: [0,128) Exits: ((127 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
370 ; CHECK-NEXT: %iv.trunc = trunc i32 %iv to i16
371 ; CHECK-NEXT: --> {(trunc i32 %start to i16),+,(trunc i32 %step to i16)}<%loop> U: [0,128) S: [0,128) Exits: ((trunc i32 %start to i16) + (127 * (trunc i32 %step to i16))<nsw>) LoopDispositions: { %loop: Computable }
372 ; CHECK-NEXT: %iv.next = add i32 %iv, %step
373 ; CHECK-NEXT: --> {(%step + %start),+,%step}<nw><%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step)<nsw> + %start) LoopDispositions: { %loop: Computable }
374 ; CHECK-NEXT: %iv.trunc.plus.one = add i16 %iv.trunc, 1
375 ; CHECK-NEXT: --> {(1 + (trunc i32 %start to i16))<nuw><nsw>,+,(trunc i32 %step to i16)}<%loop> U: [1,129) S: [1,129) Exits: (1 + (trunc i32 %start to i16) + (127 * (trunc i32 %step to i16))<nsw>) LoopDispositions: { %loop: Computable }
376 ; CHECK-NEXT: %iv.trunc.plus.two = add i16 %iv.trunc, 2
377 ; CHECK-NEXT: --> {(2 + (trunc i32 %start to i16))<nuw><nsw>,+,(trunc i32 %step to i16)}<%loop> U: [2,130) S: [2,130) Exits: (2 + (trunc i32 %start to i16) + (127 * (trunc i32 %step to i16))<nsw>) LoopDispositions: { %loop: Computable }
378 ; CHECK-NEXT: %loop.iv.inc = add i16 %loop.iv, 1
379 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable }
380 ; CHECK-NEXT: Determining loop execution counts for: @f7
381 ; CHECK-NEXT: Loop %loop: backedge-taken count is 127
382 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 127
383 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 127
384 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 127
385 ; CHECK-NEXT: Predicates:
386 ; CHECK-NEXT: Loop %loop: Trip multiple is 128
389 %start = select i1 %c, i32 127, i32 0
390 %step = select i1 %c, i32 -1, i32 1
394 %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ]
395 %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ]
396 %iv.trunc = trunc i32 %iv to i16
397 %iv.next = add i32 %iv, %step
399 %iv.trunc.plus.one = add i16 %iv.trunc, 1
401 %iv.trunc.plus.two = add i16 %iv.trunc, 2
403 %loop.iv.inc = add i16 %loop.iv, 1
404 %be.cond = icmp ne i16 %loop.iv.inc, 128
405 br i1 %be.cond, label %loop, label %leave