1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>,verify<scalar-evolution>" 2>&1 | FileCheck %s
3 ; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>,verify<scalar-evolution>" -scev-range-iter-threshold=1 2>&1 | FileCheck %s
5 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64"
7 ; Collection of cases exercising range logic, mostly (but not exclusively)
8 ; involving SCEVUnknowns.
10 declare void @llvm.assume(i1)
12 define i32 @ashr(i32 %a) {
14 ; CHECK-NEXT: Classifying expressions for: @ashr
15 ; CHECK-NEXT: %ashr = ashr i32 %a, 31
16 ; CHECK-NEXT: --> %ashr U: [0,1) S: [0,1)
17 ; CHECK-NEXT: Determining loop execution counts for: @ashr
19 %ashr = ashr i32 %a, 31
20 %pos = icmp sge i32 %a, 0
21 call void @llvm.assume(i1 %pos)
25 ; Highlight the fact that non-argument non-instructions are
27 @G = external global i8
28 define i64 @ashr_global() {
29 ; CHECK-LABEL: 'ashr_global'
30 ; CHECK-NEXT: Classifying expressions for: @ashr_global
31 ; CHECK-NEXT: %ashr = ashr i64 ptrtoint (ptr @G to i64), 63
32 ; CHECK-NEXT: --> %ashr U: [0,1) S: [0,1)
33 ; CHECK-NEXT: Determining loop execution counts for: @ashr_global
35 %ashr = ashr i64 ptrtoint (ptr @G to i64), 63
36 %pos = icmp sge ptr @G, null
37 call void @llvm.assume(i1 %pos)
42 define i32 @shl(i32 %a) {
44 ; CHECK-NEXT: Classifying expressions for: @shl
45 ; CHECK-NEXT: %res = shl i32 %a, 2
46 ; CHECK-NEXT: --> (4 * %a) U: [0,-3) S: [-2147483648,2147483645)
47 ; CHECK-NEXT: Determining loop execution counts for: @shl
50 %pos = icmp ult i32 %a, 1024
51 call void @llvm.assume(i1 %pos)
55 define i32 @lshr(i32 %a) {
57 ; CHECK-NEXT: Classifying expressions for: @lshr
58 ; CHECK-NEXT: %res = lshr i32 %a, 31
59 ; CHECK-NEXT: --> (%a /u -2147483648) U: [0,2) S: [0,2)
60 ; CHECK-NEXT: Determining loop execution counts for: @lshr
62 %res = lshr i32 %a, 31
63 %pos = icmp sge i32 %a, 0
64 call void @llvm.assume(i1 %pos)
69 define i32 @udiv(i32 %a) {
71 ; CHECK-NEXT: Classifying expressions for: @udiv
72 ; CHECK-NEXT: %res = udiv i32 %a, -2147483648
73 ; CHECK-NEXT: --> (%a /u -2147483648) U: [0,2) S: [0,2)
74 ; CHECK-NEXT: Determining loop execution counts for: @udiv
76 %res = udiv i32 %a, 2147483648
77 %pos = icmp sge i32 %a, 0
78 call void @llvm.assume(i1 %pos)
82 define i64 @sext(i8 %a) {
84 ; CHECK-NEXT: Classifying expressions for: @sext
85 ; CHECK-NEXT: %res = sext i8 %a to i64
86 ; CHECK-NEXT: --> (sext i8 %a to i64) U: [-128,128) S: [-128,128)
87 ; CHECK-NEXT: Determining loop execution counts for: @sext
89 %res = sext i8 %a to i64
90 %pos = icmp sge i8 %a, 0
91 call void @llvm.assume(i1 %pos)
95 define i64 @zext(i8 %a) {
97 ; CHECK-NEXT: Classifying expressions for: @zext
98 ; CHECK-NEXT: %res = zext i8 %a to i64
99 ; CHECK-NEXT: --> (zext i8 %a to i64) U: [0,256) S: [0,256)
100 ; CHECK-NEXT: Determining loop execution counts for: @zext
102 %res = zext i8 %a to i64
103 %pos = icmp sge i8 %a, 0
104 call void @llvm.assume(i1 %pos)
108 define i32 @phi_div() {
109 ; CHECK-LABEL: 'phi_div'
110 ; CHECK-NEXT: Classifying expressions for: @phi_div
111 ; CHECK-NEXT: %range.1 = phi i32 [ 0, %entry ], [ %shr, %loop ]
112 ; CHECK-NEXT: --> %range.1 U: [0,1) S: [0,1) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
113 ; CHECK-NEXT: %shr = lshr i32 %range.1, 1
114 ; CHECK-NEXT: --> (%range.1 /u 2) U: [0,1) S: [0,1) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
115 ; CHECK-NEXT: Determining loop execution counts for: @phi_div
116 ; CHECK-NEXT: Loop %loop: <multiple exits> Unpredictable backedge-taken count.
117 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
118 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
124 %range.1 = phi i32 [ 0, %entry ], [ %shr, %loop ]
125 %shr = lshr i32 %range.1, 1
129 define void @add_6(i32 %n) {
130 ; CHECK-LABEL: 'add_6'
131 ; CHECK-NEXT: Classifying expressions for: @add_6
132 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
133 ; CHECK-NEXT: --> {0,+,6}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,2147483647) Exits: (6 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 6) + (1 umin %n))) LoopDispositions: { %loop: Computable }
134 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 6
135 ; CHECK-NEXT: --> {6,+,6}<nuw><%loop> U: [6,-3) S: [-2147483648,2147483647) Exits: (6 + (6 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 6) + (1 umin %n)))) LoopDispositions: { %loop: Computable }
136 ; CHECK-NEXT: Determining loop execution counts for: @add_6
137 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 6) + (1 umin %n))
138 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 715827882
139 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 6) + (1 umin %n))
140 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
146 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
147 %iv.inc = add nsw i32 %iv, 6
148 %becond = icmp ult i32 %iv, %n
149 br i1 %becond, label %loop, label %leave
154 define void @add_7(i32 %n) {
155 ; CHECK-LABEL: 'add_7'
156 ; CHECK-NEXT: Classifying expressions for: @add_7
157 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
158 ; CHECK-NEXT: --> {0,+,7}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,-2147483648) Exits: (7 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 7) + (1 umin %n))) LoopDispositions: { %loop: Computable }
159 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 7
160 ; CHECK-NEXT: --> {7,+,7}<nuw><%loop> U: [7,-3) S: [7,0) Exits: (7 + (7 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 7) + (1 umin %n)))) LoopDispositions: { %loop: Computable }
161 ; CHECK-NEXT: Determining loop execution counts for: @add_7
162 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 7) + (1 umin %n))
163 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 613566756
164 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 7) + (1 umin %n))
165 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
171 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
172 %iv.inc = add nsw i32 %iv, 7
173 %becond = icmp ult i32 %iv, %n
174 br i1 %becond, label %loop, label %leave
179 define void @add_8(i32 %n) {
180 ; CHECK-LABEL: 'add_8'
181 ; CHECK-NEXT: Classifying expressions for: @add_8
182 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
183 ; CHECK-NEXT: --> {0,+,8}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,2147483641) Exits: (8 * ((7 + %n) /u 8))<nuw> LoopDispositions: { %loop: Computable }
184 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 8
185 ; CHECK-NEXT: --> {8,+,8}<nuw><%loop> U: [8,-7) S: [-2147483648,2147483641) Exits: (8 + (8 * ((7 + %n) /u 8))<nuw>) LoopDispositions: { %loop: Computable }
186 ; CHECK-NEXT: Determining loop execution counts for: @add_8
187 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((7 + %n) /u 8)
188 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 536870911
189 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((7 + %n) /u 8)
190 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
196 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
197 %iv.inc = add nsw i32 %iv, 8
198 %becond = icmp ult i32 %iv, %n
199 br i1 %becond, label %loop, label %leave
205 define void @add_9(i32 %n) {
206 ; CHECK-LABEL: 'add_9'
207 ; CHECK-NEXT: Classifying expressions for: @add_9
208 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
209 ; CHECK-NEXT: --> {0,+,9}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,-2147483648) Exits: (9 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))) LoopDispositions: { %loop: Computable }
210 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 9
211 ; CHECK-NEXT: --> {9,+,9}<nuw><%loop> U: [9,-3) S: [9,0) Exits: (9 + (9 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n)))) LoopDispositions: { %loop: Computable }
212 ; CHECK-NEXT: Determining loop execution counts for: @add_9
213 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
214 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 477218588
215 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
216 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
222 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
223 %iv.inc = add nsw i32 %iv, 9
224 %becond = icmp ult i32 %iv, %n
225 br i1 %becond, label %loop, label %leave
231 define void @add_10(i32 %n) {
232 ; CHECK-LABEL: 'add_10'
233 ; CHECK-NEXT: Classifying expressions for: @add_10
234 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
235 ; CHECK-NEXT: --> {0,+,10}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,2147483647) Exits: (10 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 10) + (1 umin %n))) LoopDispositions: { %loop: Computable }
236 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 10
237 ; CHECK-NEXT: --> {10,+,10}<nuw><%loop> U: [10,-5) S: [-2147483648,2147483647) Exits: (10 + (10 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 10) + (1 umin %n)))) LoopDispositions: { %loop: Computable }
238 ; CHECK-NEXT: Determining loop execution counts for: @add_10
239 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 10) + (1 umin %n))
240 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 429496729
241 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 10) + (1 umin %n))
242 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
248 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
249 %iv.inc = add nsw i32 %iv, 10
250 %becond = icmp ult i32 %iv, %n
251 br i1 %becond, label %loop, label %leave
257 define void @add_8_wrap(i32 %n) {
258 ; CHECK-LABEL: 'add_8_wrap'
259 ; CHECK-NEXT: Classifying expressions for: @add_8_wrap
260 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
261 ; CHECK-NEXT: --> {0,+,8}<%loop> U: [0,-7) S: [-2147483648,2147483641) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
262 ; CHECK-NEXT: %iv.inc = add i32 %iv, 8
263 ; CHECK-NEXT: --> {8,+,8}<%loop> U: [0,-7) S: [-2147483648,2147483641) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
264 ; CHECK-NEXT: Determining loop execution counts for: @add_8_wrap
265 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
266 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
267 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
273 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
274 %iv.inc = add i32 %iv, 8
275 %becond = icmp ult i32 %iv, %n
276 br i1 %becond, label %loop, label %leave
282 define void @add_10_wrap(i32 %n) {
283 ; CHECK-LABEL: 'add_10_wrap'
284 ; CHECK-NEXT: Classifying expressions for: @add_10_wrap
285 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
286 ; CHECK-NEXT: --> {0,+,10}<%loop> U: [0,-1) S: [-2147483648,2147483647) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
287 ; CHECK-NEXT: %iv.inc = add i32 %iv, 10
288 ; CHECK-NEXT: --> {10,+,10}<%loop> U: [0,-1) S: [-2147483648,2147483647) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
289 ; CHECK-NEXT: Determining loop execution counts for: @add_10_wrap
290 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
291 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
292 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
298 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
299 %iv.inc = add i32 %iv, 10
300 %becond = icmp ult i32 %iv, %n
301 br i1 %becond, label %loop, label %leave
307 define void @mul_6(i32 %n) {
308 ; CHECK-LABEL: 'mul_6'
309 ; CHECK-NEXT: Classifying expressions for: @mul_6
310 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
311 ; CHECK-NEXT: --> %iv U: [0,-1) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
312 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 6
313 ; CHECK-NEXT: --> (6 * %iv) U: [0,-3) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
314 ; CHECK-NEXT: Determining loop execution counts for: @mul_6
315 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
316 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
317 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
323 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
324 %iv.inc = mul nuw i32 %iv, 6
325 %becond = icmp ult i32 %iv, %n
326 br i1 %becond, label %loop, label %leave
332 define void @mul_7(i32 %n) {
333 ; CHECK-LABEL: 'mul_7'
334 ; CHECK-NEXT: Classifying expressions for: @mul_7
335 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
336 ; CHECK-NEXT: --> %iv U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
337 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 7
338 ; CHECK-NEXT: --> (7 * %iv) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
339 ; CHECK-NEXT: Determining loop execution counts for: @mul_7
340 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
341 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
342 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
348 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
349 %iv.inc = mul nuw i32 %iv, 7
350 %becond = icmp ult i32 %iv, %n
351 br i1 %becond, label %loop, label %leave
357 define void @mul_8(i32 %n) {
358 ; CHECK-LABEL: 'mul_8'
359 ; CHECK-NEXT: Classifying expressions for: @mul_8
360 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
361 ; CHECK-NEXT: --> %iv U: [0,-7) S: [-2147483648,2147483585) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
362 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 8
363 ; CHECK-NEXT: --> (8 * %iv) U: [0,-63) S: [-2147483648,2147483585) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
364 ; CHECK-NEXT: Determining loop execution counts for: @mul_8
365 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
366 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
367 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
373 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
374 %iv.inc = mul nuw i32 %iv, 8
375 %becond = icmp ult i32 %iv, %n
376 br i1 %becond, label %loop, label %leave
382 define void @mul_9(i32 %n) {
383 ; CHECK-LABEL: 'mul_9'
384 ; CHECK-NEXT: Classifying expressions for: @mul_9
385 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
386 ; CHECK-NEXT: --> %iv U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
387 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 9
388 ; CHECK-NEXT: --> (9 * %iv) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
389 ; CHECK-NEXT: Determining loop execution counts for: @mul_9
390 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
391 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
392 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
398 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
399 %iv.inc = mul nuw i32 %iv, 9
400 %becond = icmp ult i32 %iv, %n
401 br i1 %becond, label %loop, label %leave
407 define void @mul_10(i32 %n) {
408 ; CHECK-LABEL: 'mul_10'
409 ; CHECK-NEXT: Classifying expressions for: @mul_10
410 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
411 ; CHECK-NEXT: --> %iv U: [0,-1) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
412 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 10
413 ; CHECK-NEXT: --> (10 * %iv) U: [0,-3) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
414 ; CHECK-NEXT: Determining loop execution counts for: @mul_10
415 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
416 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
417 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
423 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
424 %iv.inc = mul nuw i32 %iv, 10
425 %becond = icmp ult i32 %iv, %n
426 br i1 %becond, label %loop, label %leave
432 define void @mul_8_wrap(i32 %n) {
433 ; CHECK-LABEL: 'mul_8_wrap'
434 ; CHECK-NEXT: Classifying expressions for: @mul_8_wrap
435 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
436 ; CHECK-NEXT: --> %iv U: [0,-7) S: [-2147483648,2147483585) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
437 ; CHECK-NEXT: %iv.inc = mul i32 %iv, 8
438 ; CHECK-NEXT: --> (8 * %iv) U: [0,-63) S: [-2147483648,2147483585) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
439 ; CHECK-NEXT: Determining loop execution counts for: @mul_8_wrap
440 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
441 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
442 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
448 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
449 %iv.inc = mul i32 %iv, 8
450 %becond = icmp ult i32 %iv, %n
451 br i1 %becond, label %loop, label %leave
457 define void @mul_10_wrap(i32 %n) {
458 ; CHECK-LABEL: 'mul_10_wrap'
459 ; CHECK-NEXT: Classifying expressions for: @mul_10_wrap
460 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
461 ; CHECK-NEXT: --> %iv U: [0,-1) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
462 ; CHECK-NEXT: %iv.inc = mul i32 %iv, 10
463 ; CHECK-NEXT: --> (10 * %iv) U: [0,-3) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
464 ; CHECK-NEXT: Determining loop execution counts for: @mul_10_wrap
465 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
466 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
467 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
473 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
474 %iv.inc = mul i32 %iv, 10
475 %becond = icmp ult i32 %iv, %n
476 br i1 %becond, label %loop, label %leave
482 define void @truncate(i16 %n) {
483 ; %t is not a multiple of 7 because we cannot make the assumption through truncation
484 ; CHECK-LABEL: 'truncate'
485 ; CHECK-NEXT: Classifying expressions for: @truncate
486 ; CHECK-NEXT: %iv = phi i16 [ 0, %entry ], [ %iv.inc, %loop ]
487 ; CHECK-NEXT: --> {0,+,9}<nuw><%loop> U: [0,-6) S: [0,-6) Exits: (9 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))) LoopDispositions: { %loop: Computable }
488 ; CHECK-NEXT: %iv.inc = add nuw i16 %iv, 9
489 ; CHECK-NEXT: --> {9,+,9}<nw><%loop> U: [9,3) S: [9,3) Exits: (9 + (9 * ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n)))) LoopDispositions: { %loop: Computable }
490 ; CHECK-NEXT: %t = trunc i16 %iv.inc to i8
491 ; CHECK-NEXT: --> {9,+,9}<%loop> U: full-set S: full-set Exits: (9 + (9 * (trunc i16 ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n)) to i8))) LoopDispositions: { %loop: Computable }
492 ; CHECK-NEXT: Determining loop execution counts for: @truncate
493 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
494 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i16 7281
495 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
496 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
502 %iv = phi i16 [ 0, %entry ], [ %iv.inc, %loop ]
503 %iv.inc = add nuw i16 %iv, 9
504 %t = trunc i16 %iv.inc to i8
505 %becond = icmp ult i16 %iv, %n
506 br i1 %becond, label %loop, label %leave