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.
119 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
125 %range.1 = phi i32 [ 0, %entry ], [ %shr, %loop ]
126 %shr = lshr i32 %range.1, 1
130 define void @add_6(i32 %n) {
131 ; CHECK-LABEL: 'add_6'
132 ; CHECK-NEXT: Classifying expressions for: @add_6
133 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
134 ; 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 }
135 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 6
136 ; 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 }
137 ; CHECK-NEXT: Determining loop execution counts for: @add_6
138 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 6) + (1 umin %n))
139 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 715827882
140 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 6) + (1 umin %n))
141 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 6) + (1 umin %n))
142 ; CHECK-NEXT: Predicates:
143 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
149 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
150 %iv.inc = add nsw i32 %iv, 6
151 %becond = icmp ult i32 %iv, %n
152 br i1 %becond, label %loop, label %leave
157 define void @add_7(i32 %n) {
158 ; CHECK-LABEL: 'add_7'
159 ; CHECK-NEXT: Classifying expressions for: @add_7
160 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
161 ; 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 }
162 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 7
163 ; 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 }
164 ; CHECK-NEXT: Determining loop execution counts for: @add_7
165 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 7) + (1 umin %n))
166 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 613566756
167 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 7) + (1 umin %n))
168 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 7) + (1 umin %n))
169 ; CHECK-NEXT: Predicates:
170 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
176 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
177 %iv.inc = add nsw i32 %iv, 7
178 %becond = icmp ult i32 %iv, %n
179 br i1 %becond, label %loop, label %leave
184 define void @add_8(i32 %n) {
185 ; CHECK-LABEL: 'add_8'
186 ; CHECK-NEXT: Classifying expressions for: @add_8
187 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
188 ; CHECK-NEXT: --> {0,+,8}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,2147483641) Exits: (8 * ((7 + %n) /u 8))<nuw> LoopDispositions: { %loop: Computable }
189 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 8
190 ; CHECK-NEXT: --> {8,+,8}<nuw><%loop> U: [8,-7) S: [-2147483648,2147483641) Exits: (8 + (8 * ((7 + %n) /u 8))<nuw>) LoopDispositions: { %loop: Computable }
191 ; CHECK-NEXT: Determining loop execution counts for: @add_8
192 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((7 + %n) /u 8)
193 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 536870911
194 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((7 + %n) /u 8)
195 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((7 + %n) /u 8)
196 ; CHECK-NEXT: Predicates:
197 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
203 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
204 %iv.inc = add nsw i32 %iv, 8
205 %becond = icmp ult i32 %iv, %n
206 br i1 %becond, label %loop, label %leave
212 define void @add_9(i32 %n) {
213 ; CHECK-LABEL: 'add_9'
214 ; CHECK-NEXT: Classifying expressions for: @add_9
215 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
216 ; 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 }
217 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 9
218 ; 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 }
219 ; CHECK-NEXT: Determining loop execution counts for: @add_9
220 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
221 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 477218588
222 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
223 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
224 ; CHECK-NEXT: Predicates:
225 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
231 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
232 %iv.inc = add nsw i32 %iv, 9
233 %becond = icmp ult i32 %iv, %n
234 br i1 %becond, label %loop, label %leave
240 define void @add_10(i32 %n) {
241 ; CHECK-LABEL: 'add_10'
242 ; CHECK-NEXT: Classifying expressions for: @add_10
243 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
244 ; 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 }
245 ; CHECK-NEXT: %iv.inc = add nsw i32 %iv, 10
246 ; 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 }
247 ; CHECK-NEXT: Determining loop execution counts for: @add_10
248 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 10) + (1 umin %n))
249 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 429496729
250 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 10) + (1 umin %n))
251 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 10) + (1 umin %n))
252 ; CHECK-NEXT: Predicates:
253 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
259 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
260 %iv.inc = add nsw i32 %iv, 10
261 %becond = icmp ult i32 %iv, %n
262 br i1 %becond, label %loop, label %leave
268 define void @add_8_wrap(i32 %n) {
269 ; CHECK-LABEL: 'add_8_wrap'
270 ; CHECK-NEXT: Classifying expressions for: @add_8_wrap
271 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
272 ; CHECK-NEXT: --> {0,+,8}<%loop> U: [0,-7) S: [-2147483648,2147483641) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
273 ; CHECK-NEXT: %iv.inc = add i32 %iv, 8
274 ; CHECK-NEXT: --> {8,+,8}<%loop> U: [0,-7) S: [-2147483648,2147483641) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
275 ; CHECK-NEXT: Determining loop execution counts for: @add_8_wrap
276 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
277 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
278 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
279 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
285 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
286 %iv.inc = add i32 %iv, 8
287 %becond = icmp ult i32 %iv, %n
288 br i1 %becond, label %loop, label %leave
294 define void @add_10_wrap(i32 %n) {
295 ; CHECK-LABEL: 'add_10_wrap'
296 ; CHECK-NEXT: Classifying expressions for: @add_10_wrap
297 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
298 ; CHECK-NEXT: --> {0,+,10}<%loop> U: [0,-1) S: [-2147483648,2147483647) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
299 ; CHECK-NEXT: %iv.inc = add i32 %iv, 10
300 ; CHECK-NEXT: --> {10,+,10}<%loop> U: [0,-1) S: [-2147483648,2147483647) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
301 ; CHECK-NEXT: Determining loop execution counts for: @add_10_wrap
302 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
303 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
304 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
305 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
311 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
312 %iv.inc = add i32 %iv, 10
313 %becond = icmp ult i32 %iv, %n
314 br i1 %becond, label %loop, label %leave
320 define void @mul_6(i32 %n) {
321 ; CHECK-LABEL: 'mul_6'
322 ; CHECK-NEXT: Classifying expressions for: @mul_6
323 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
324 ; CHECK-NEXT: --> %iv U: [0,-1) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
325 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 6
326 ; CHECK-NEXT: --> (6 * %iv) U: [0,-3) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
327 ; CHECK-NEXT: Determining loop execution counts for: @mul_6
328 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
329 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
330 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
331 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
337 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
338 %iv.inc = mul nuw i32 %iv, 6
339 %becond = icmp ult i32 %iv, %n
340 br i1 %becond, label %loop, label %leave
346 define void @mul_7(i32 %n) {
347 ; CHECK-LABEL: 'mul_7'
348 ; CHECK-NEXT: Classifying expressions for: @mul_7
349 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
350 ; CHECK-NEXT: --> %iv U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
351 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 7
352 ; CHECK-NEXT: --> (7 * %iv) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
353 ; CHECK-NEXT: Determining loop execution counts for: @mul_7
354 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
355 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
356 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
357 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
363 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
364 %iv.inc = mul nuw i32 %iv, 7
365 %becond = icmp ult i32 %iv, %n
366 br i1 %becond, label %loop, label %leave
372 define void @mul_8(i32 %n) {
373 ; CHECK-LABEL: 'mul_8'
374 ; CHECK-NEXT: Classifying expressions for: @mul_8
375 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
376 ; CHECK-NEXT: --> %iv U: [0,-7) S: [-2147483648,2147483585) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
377 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 8
378 ; CHECK-NEXT: --> (8 * %iv) U: [0,-63) S: [-2147483648,2147483585) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
379 ; CHECK-NEXT: Determining loop execution counts for: @mul_8
380 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
381 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
382 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
383 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
389 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
390 %iv.inc = mul nuw i32 %iv, 8
391 %becond = icmp ult i32 %iv, %n
392 br i1 %becond, label %loop, label %leave
398 define void @mul_9(i32 %n) {
399 ; CHECK-LABEL: 'mul_9'
400 ; CHECK-NEXT: Classifying expressions for: @mul_9
401 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
402 ; CHECK-NEXT: --> %iv U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
403 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 9
404 ; CHECK-NEXT: --> (9 * %iv) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
405 ; CHECK-NEXT: Determining loop execution counts for: @mul_9
406 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
407 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
408 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
409 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
415 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
416 %iv.inc = mul nuw i32 %iv, 9
417 %becond = icmp ult i32 %iv, %n
418 br i1 %becond, label %loop, label %leave
424 define void @mul_10(i32 %n) {
425 ; CHECK-LABEL: 'mul_10'
426 ; CHECK-NEXT: Classifying expressions for: @mul_10
427 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
428 ; CHECK-NEXT: --> %iv U: [0,-1) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
429 ; CHECK-NEXT: %iv.inc = mul nuw i32 %iv, 10
430 ; CHECK-NEXT: --> (10 * %iv) U: [0,-3) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
431 ; CHECK-NEXT: Determining loop execution counts for: @mul_10
432 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
433 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
434 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
435 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
441 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
442 %iv.inc = mul nuw i32 %iv, 10
443 %becond = icmp ult i32 %iv, %n
444 br i1 %becond, label %loop, label %leave
450 define void @mul_8_wrap(i32 %n) {
451 ; CHECK-LABEL: 'mul_8_wrap'
452 ; CHECK-NEXT: Classifying expressions for: @mul_8_wrap
453 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
454 ; CHECK-NEXT: --> %iv U: [0,-7) S: [-2147483648,2147483585) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
455 ; CHECK-NEXT: %iv.inc = mul i32 %iv, 8
456 ; CHECK-NEXT: --> (8 * %iv) U: [0,-63) S: [-2147483648,2147483585) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
457 ; CHECK-NEXT: Determining loop execution counts for: @mul_8_wrap
458 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
459 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
460 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
461 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
467 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
468 %iv.inc = mul i32 %iv, 8
469 %becond = icmp ult i32 %iv, %n
470 br i1 %becond, label %loop, label %leave
476 define void @mul_10_wrap(i32 %n) {
477 ; CHECK-LABEL: 'mul_10_wrap'
478 ; CHECK-NEXT: Classifying expressions for: @mul_10_wrap
479 ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
480 ; CHECK-NEXT: --> %iv U: [0,-1) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
481 ; CHECK-NEXT: %iv.inc = mul i32 %iv, 10
482 ; CHECK-NEXT: --> (10 * %iv) U: [0,-3) S: [-2147483648,2147483645) Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
483 ; CHECK-NEXT: Determining loop execution counts for: @mul_10_wrap
484 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
485 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
486 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
487 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
493 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
494 %iv.inc = mul i32 %iv, 10
495 %becond = icmp ult i32 %iv, %n
496 br i1 %becond, label %loop, label %leave
502 define void @truncate(i16 %n) {
503 ; %t is not a multiple of 7 because we cannot make the assumption through truncation
504 ; CHECK-LABEL: 'truncate'
505 ; CHECK-NEXT: Classifying expressions for: @truncate
506 ; CHECK-NEXT: %iv = phi i16 [ 0, %entry ], [ %iv.inc, %loop ]
507 ; 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 }
508 ; CHECK-NEXT: %iv.inc = add nuw i16 %iv, 9
509 ; 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 }
510 ; CHECK-NEXT: %t = trunc i16 %iv.inc to i8
511 ; 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 }
512 ; CHECK-NEXT: Determining loop execution counts for: @truncate
513 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
514 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 7281
515 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
516 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((((-1 * (1 umin %n))<nuw><nsw> + %n) /u 9) + (1 umin %n))
517 ; CHECK-NEXT: Predicates:
518 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
524 %iv = phi i16 [ 0, %entry ], [ %iv.inc, %loop ]
525 %iv.inc = add nuw i16 %iv, 9
526 %t = trunc i16 %iv.inc to i8
527 %becond = icmp ult i16 %iv, %n
528 br i1 %becond, label %loop, label %leave