Skip to content

Commit cf2e828

Browse files
authored
SCEV: regen some tests with UTC (#123050)
While at it, move a test that calls the IndVarSimplify pass into the IndVarSimplify directory.
1 parent a00938e commit cf2e828

File tree

5 files changed

+314
-114
lines changed

5 files changed

+314
-114
lines changed
Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
1-
; RUN: opt < %s "-passes=print<scalar-evolution>" -disable-output 2>&1 | FileCheck %s
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt < %s -passes="print<scalar-evolution>" -disable-output \
3+
; RUN: -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
24
; PR1597
35

4-
; CHECK: Loop %bb: backedge-taken count is (-1 + (-1 * %x) + %y)
5-
66
define i32 @f(i32 %x, i32 %y) {
7+
; CHECK-LABEL: 'f'
8+
; CHECK-NEXT: Determining loop execution counts for: @f
9+
; CHECK-NEXT: Loop %bb: backedge-taken count is (-1 + (-1 * %x) + %y)
10+
; CHECK-NEXT: Loop %bb: constant max backedge-taken count is i32 -1
11+
; CHECK-NEXT: Loop %bb: symbolic max backedge-taken count is (-1 + (-1 * %x) + %y)
12+
; CHECK-NEXT: Loop %bb: Trip multiple is 1
13+
;
714
entry:
8-
%tmp63 = icmp ult i32 %x, %y ; <i1> [#uses=1]
9-
br i1 %tmp63, label %bb.preheader, label %bb8
15+
%tmp63 = icmp ult i32 %x, %y ; <i1> [#uses=1]
16+
br i1 %tmp63, label %bb.preheader, label %bb8
1017

1118
bb.preheader: ; preds = %entry
12-
br label %bb
19+
br label %bb
1320

1421
bb: ; preds = %bb3, %bb.preheader
15-
%x_addr.0 = phi i32 [ %tmp2, %bb3 ], [ %x, %bb.preheader ] ; <i32> [#uses=1]
16-
%tmp2 = add i32 %x_addr.0, 1 ; <i32> [#uses=3]
17-
br label %bb3
22+
%x_addr.0 = phi i32 [ %tmp2, %bb3 ], [ %x, %bb.preheader ] ; <i32> [#uses=1]
23+
%tmp2 = add i32 %x_addr.0, 1 ; <i32> [#uses=3]
24+
br label %bb3
1825

1926
bb3: ; preds = %bb
20-
%tmp6 = icmp ult i32 %tmp2, %y ; <i1> [#uses=1]
21-
br i1 %tmp6, label %bb, label %bb8.loopexit
27+
%tmp6 = icmp ult i32 %tmp2, %y ; <i1> [#uses=1]
28+
br i1 %tmp6, label %bb, label %bb8.loopexit
2229

2330
bb8.loopexit: ; preds = %bb3
24-
br label %bb8
31+
br label %bb8
2532

2633
bb8: ; preds = %bb8.loopexit, %entry
27-
%x_addr.1 = phi i32 [ %x, %entry ], [ %tmp2, %bb8.loopexit ] ; <i32> [#uses=1]
28-
br label %return
34+
%x_addr.1 = phi i32 [ %x, %entry ], [ %tmp2, %bb8.loopexit ] ; <i32> [#uses=1]
35+
br label %return
2936

3037
return: ; preds = %bb8
31-
ret i32 %x_addr.1
38+
ret i32 %x_addr.1
3239
}

llvm/test/Analysis/ScalarEvolution/implied-via-addition.ll

Lines changed: 0 additions & 50 deletions
This file was deleted.

llvm/test/Analysis/ScalarEvolution/implied-via-division.ll

Lines changed: 115 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt < %s -disable-output -passes="print<scalar-evolution>" \
3+
; RUN: -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
24

35
declare void @llvm.experimental.guard(i1, ...)
46

57
define void @test_1(i32 %n) nounwind {
68
; Prove that (n > 1) ===> (n / 2 > 0).
7-
; CHECK: Determining loop execution counts for: @test_1
8-
; CHECK: Loop %header: backedge-taken count is (-1 + %n.div.2)<nsw>
9+
; CHECK-LABEL: 'test_1'
10+
; CHECK-NEXT: Determining loop execution counts for: @test_1
11+
; CHECK-NEXT: Loop %header: backedge-taken count is (-1 + %n.div.2)<nsw>
12+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i32 1073741822
13+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (-1 + %n.div.2)<nsw>
14+
; CHECK-NEXT: Loop %header: Trip multiple is 1
15+
;
916
entry:
1017
%cmp1 = icmp sgt i32 %n, 1
1118
%n.div.2 = sdiv i32 %n, 2
@@ -24,8 +31,13 @@ exit:
2431

2532
define void @test_1neg(i32 %n) nounwind {
2633
; Prove that (n > 0) =\=> (n / 2 > 0).
27-
; CHECK: Determining loop execution counts for: @test_1neg
28-
; CHECK: Loop %header: backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
34+
; CHECK-LABEL: 'test_1neg'
35+
; CHECK-NEXT: Determining loop execution counts for: @test_1neg
36+
; CHECK-NEXT: Loop %header: backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
37+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i32 1073741822
38+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
39+
; CHECK-NEXT: Loop %header: Trip multiple is 1
40+
;
2941
entry:
3042
%cmp1 = icmp sgt i32 %n, 0
3143
%n.div.2 = sdiv i32 %n, 2
@@ -44,8 +56,13 @@ exit:
4456

4557
define void @test_2(i32 %n) nounwind {
4658
; Prove that (n >= 2) ===> (n / 2 > 0).
47-
; CHECK: Determining loop execution counts for: @test_2
48-
; CHECK: Loop %header: backedge-taken count is (-1 + %n.div.2)<nsw>
59+
; CHECK-LABEL: 'test_2'
60+
; CHECK-NEXT: Determining loop execution counts for: @test_2
61+
; CHECK-NEXT: Loop %header: backedge-taken count is (-1 + %n.div.2)<nsw>
62+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i32 1073741822
63+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (-1 + %n.div.2)<nsw>
64+
; CHECK-NEXT: Loop %header: Trip multiple is 1
65+
;
4966
entry:
5067
%cmp1 = icmp sge i32 %n, 2
5168
%n.div.2 = sdiv i32 %n, 2
@@ -64,8 +81,13 @@ exit:
6481

6582
define void @test_2neg(i32 %n) nounwind {
6683
; Prove that (n >= 1) =\=> (n / 2 > 0).
67-
; CHECK: Determining loop execution counts for: @test_2neg
68-
; CHECK: Loop %header: backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
84+
; CHECK-LABEL: 'test_2neg'
85+
; CHECK-NEXT: Determining loop execution counts for: @test_2neg
86+
; CHECK-NEXT: Loop %header: backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
87+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i32 1073741822
88+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
89+
; CHECK-NEXT: Loop %header: Trip multiple is 1
90+
;
6991
entry:
7092
%cmp1 = icmp sge i32 %n, 1
7193
%n.div.2 = sdiv i32 %n, 2
@@ -84,8 +106,13 @@ exit:
84106

85107
define void @test_3(i32 %n) nounwind {
86108
; Prove that (n > -2) ===> (n / 2 >= 0).
87-
; CHECK: Determining loop execution counts for: @test_3
88-
; CHECK: Loop %header: backedge-taken count is (1 + %n.div.2)<nsw>
109+
; CHECK-LABEL: 'test_3'
110+
; CHECK-NEXT: Determining loop execution counts for: @test_3
111+
; CHECK-NEXT: Loop %header: backedge-taken count is (1 + %n.div.2)<nsw>
112+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i32 1073741824
113+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (1 + %n.div.2)<nsw>
114+
; CHECK-NEXT: Loop %header: Trip multiple is 1
115+
;
89116
entry:
90117
%cmp1 = icmp sgt i32 %n, -2
91118
%n.div.2 = sdiv i32 %n, 2
@@ -104,8 +131,13 @@ exit:
104131

105132
define void @test_3neg(i32 %n) nounwind {
106133
; Prove that (n > -3) =\=> (n / 2 >= 0).
107-
; CHECK: Determining loop execution counts for: @test_3neg
108-
; CHECK: Loop %header: backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
134+
; CHECK-LABEL: 'test_3neg'
135+
; CHECK-NEXT: Determining loop execution counts for: @test_3neg
136+
; CHECK-NEXT: Loop %header: backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
137+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i32 1073741824
138+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
139+
; CHECK-NEXT: Loop %header: Trip multiple is 1
140+
;
109141
entry:
110142
%cmp1 = icmp sgt i32 %n, -3
111143
%n.div.2 = sdiv i32 %n, 2
@@ -124,8 +156,13 @@ exit:
124156

125157
define void @test_4(i32 %n) nounwind {
126158
; Prove that (n >= -1) ===> (n / 2 >= 0).
127-
; CHECK: Determining loop execution counts for: @test_4
128-
; CHECK: Loop %header: backedge-taken count is (1 + %n.div.2)<nsw>
159+
; CHECK-LABEL: 'test_4'
160+
; CHECK-NEXT: Determining loop execution counts for: @test_4
161+
; CHECK-NEXT: Loop %header: backedge-taken count is (1 + %n.div.2)<nsw>
162+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i32 1073741824
163+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (1 + %n.div.2)<nsw>
164+
; CHECK-NEXT: Loop %header: Trip multiple is 1
165+
;
129166
entry:
130167
%cmp1 = icmp sge i32 %n, -1
131168
%n.div.2 = sdiv i32 %n, 2
@@ -144,8 +181,13 @@ exit:
144181

145182
define void @test_4neg(i32 %n) nounwind {
146183
; Prove that (n >= -2) =\=> (n / 2 >= 0).
147-
; CHECK: Determining loop execution counts for: @test_4neg
148-
; CHECK: Loop %header: backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
184+
; CHECK-LABEL: 'test_4neg'
185+
; CHECK-NEXT: Determining loop execution counts for: @test_4neg
186+
; CHECK-NEXT: Loop %header: backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
187+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i32 1073741824
188+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
189+
; CHECK-NEXT: Loop %header: Trip multiple is 1
190+
;
149191
entry:
150192
%cmp1 = icmp sge i32 %n, -2
151193
%n.div.2 = sdiv i32 %n, 2
@@ -164,8 +206,13 @@ exit:
164206

165207
define void @test_ext_01(i32 %n) nounwind {
166208
; Prove that (n > 1) ===> (n / 2 > 0).
167-
; CHECK: Determining loop execution counts for: @test_ext_01
168-
; CHECK: Loop %header: backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
209+
; CHECK-LABEL: 'test_ext_01'
210+
; CHECK-NEXT: Determining loop execution counts for: @test_ext_01
211+
; CHECK-NEXT: Loop %header: backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
212+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i64 1073741822
213+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
214+
; CHECK-NEXT: Loop %header: Trip multiple is 1
215+
;
169216
entry:
170217
%cmp1 = icmp sgt i32 %n, 1
171218
%n.div.2 = sdiv i32 %n, 2
@@ -185,8 +232,13 @@ exit:
185232

186233
define void @test_ext_01neg(i32 %n) nounwind {
187234
; Prove that (n > 0) =\=> (n / 2 > 0).
188-
; CHECK: Determining loop execution counts for: @test_ext_01neg
189-
; CHECK: Loop %header: backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
235+
; CHECK-LABEL: 'test_ext_01neg'
236+
; CHECK-NEXT: Determining loop execution counts for: @test_ext_01neg
237+
; CHECK-NEXT: Loop %header: backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
238+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i64 1073741822
239+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
240+
; CHECK-NEXT: Loop %header: Trip multiple is 1
241+
;
190242
entry:
191243
%cmp1 = icmp sgt i32 %n, 0
192244
%n.div.2 = sdiv i32 %n, 2
@@ -206,8 +258,13 @@ exit:
206258

207259
define void @test_ext_02(i32 %n) nounwind {
208260
; Prove that (n >= 2) ===> (n / 2 > 0).
209-
; CHECK: Determining loop execution counts for: @test_ext_02
210-
; CHECK: Loop %header: backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
261+
; CHECK-LABEL: 'test_ext_02'
262+
; CHECK-NEXT: Determining loop execution counts for: @test_ext_02
263+
; CHECK-NEXT: Loop %header: backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
264+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i64 1073741822
265+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
266+
; CHECK-NEXT: Loop %header: Trip multiple is 1
267+
;
211268
entry:
212269
%cmp1 = icmp sge i32 %n, 2
213270
%n.div.2 = sdiv i32 %n, 2
@@ -227,8 +284,13 @@ exit:
227284

228285
define void @test_ext_02neg(i32 %n) nounwind {
229286
; Prove that (n >= 1) =\=> (n / 2 > 0).
230-
; CHECK: Determining loop execution counts for: @test_ext_02neg
231-
; CHECK: Loop %header: backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
287+
; CHECK-LABEL: 'test_ext_02neg'
288+
; CHECK-NEXT: Determining loop execution counts for: @test_ext_02neg
289+
; CHECK-NEXT: Loop %header: backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
290+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i64 1073741822
291+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
292+
; CHECK-NEXT: Loop %header: Trip multiple is 1
293+
;
232294
entry:
233295
%cmp1 = icmp sge i32 %n, 1
234296
%n.div.2 = sdiv i32 %n, 2
@@ -248,8 +310,13 @@ exit:
248310

249311
define void @test_ext_03(i32 %n) nounwind {
250312
; Prove that (n > -2) ===> (n / 2 >= 0).
251-
; CHECK: Determining loop execution counts for: @test_ext_03
252-
; CHECK: Loop %header: backedge-taken count is (1 + (sext i32 %n.div.2 to i64))<nsw>
313+
; CHECK-LABEL: 'test_ext_03'
314+
; CHECK-NEXT: Determining loop execution counts for: @test_ext_03
315+
; CHECK-NEXT: Loop %header: backedge-taken count is (1 + (sext i32 %n.div.2 to i64))<nsw>
316+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i64 1073741824
317+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (1 + (sext i32 %n.div.2 to i64))<nsw>
318+
; CHECK-NEXT: Loop %header: Trip multiple is 1
319+
;
253320
entry:
254321
%cmp1 = icmp sgt i32 %n, -2
255322
%n.div.2 = sdiv i32 %n, 2
@@ -269,8 +336,13 @@ exit:
269336

270337
define void @test_ext_03neg(i32 %n) nounwind {
271338
; Prove that (n > -3) =\=> (n / 2 >= 0).
272-
; CHECK: Determining loop execution counts for: @test_ext_03neg
273-
; CHECK: Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
339+
; CHECK-LABEL: 'test_ext_03neg'
340+
; CHECK-NEXT: Determining loop execution counts for: @test_ext_03neg
341+
; CHECK-NEXT: Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
342+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i64 1073741824
343+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
344+
; CHECK-NEXT: Loop %header: Trip multiple is 1
345+
;
274346
entry:
275347
%cmp1 = icmp sgt i32 %n, -3
276348
%n.div.2 = sdiv i32 %n, 2
@@ -290,8 +362,13 @@ exit:
290362

291363
define void @test_ext_04(i32 %n) nounwind {
292364
; Prove that (n >= -1) ===> (n / 2 >= 0).
293-
; CHECK: Determining loop execution counts for: @test_ext_04
294-
; CHECK: Loop %header: backedge-taken count is (1 + (sext i32 %n.div.2 to i64))<nsw>
365+
; CHECK-LABEL: 'test_ext_04'
366+
; CHECK-NEXT: Determining loop execution counts for: @test_ext_04
367+
; CHECK-NEXT: Loop %header: backedge-taken count is (1 + (sext i32 %n.div.2 to i64))<nsw>
368+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i64 1073741824
369+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (1 + (sext i32 %n.div.2 to i64))<nsw>
370+
; CHECK-NEXT: Loop %header: Trip multiple is 1
371+
;
295372
entry:
296373
%cmp1 = icmp sge i32 %n, -1
297374
%n.div.2 = sdiv i32 %n, 2
@@ -311,8 +388,13 @@ exit:
311388

312389
define void @test_ext_04neg(i32 %n) nounwind {
313390
; Prove that (n >= -2) =\=> (n / 2 >= 0).
314-
; CHECK: Determining loop execution counts for: @test_ext_04neg
315-
; CHECK: Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
391+
; CHECK-LABEL: 'test_ext_04neg'
392+
; CHECK-NEXT: Determining loop execution counts for: @test_ext_04neg
393+
; CHECK-NEXT: Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
394+
; CHECK-NEXT: Loop %header: constant max backedge-taken count is i64 1073741824
395+
; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
396+
; CHECK-NEXT: Loop %header: Trip multiple is 1
397+
;
316398
entry:
317399
%cmp1 = icmp sge i32 %n, -2
318400
%n.div.2 = sdiv i32 %n, 2

0 commit comments

Comments
 (0)