1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -analyze -enable-new-pm=0 -scalar-evolution -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
3 ; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 2>&1 2>&1 | FileCheck %s
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 define void @unsimplified_and1(i32 %n) {
9 ; CHECK-LABEL: 'unsimplified_and1'
10 ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and1
11 ; CHECK-NEXT: Loop %loop: backedge-taken count is %n
12 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
13 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n
14 ; CHECK-NEXT: Predicates:
15 ; CHECK: Loop %loop: Trip multiple is 1
21 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
22 %iv.inc = add nsw i32 %iv, 1
23 %becond = icmp ule i32 %iv.inc, %n
24 %and = select i1 %becond, i1 true, i1 false
25 br i1 %and, label %loop, label %leave
31 define void @unsimplified_and2(i32 %n) {
32 ; CHECK-LABEL: 'unsimplified_and2'
33 ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and2
34 ; CHECK-NEXT: Loop %loop: backedge-taken count is %n
35 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
36 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n
37 ; CHECK-NEXT: Predicates:
38 ; CHECK: Loop %loop: Trip multiple is 1
44 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
45 %iv.inc = add nsw i32 %iv, 1
46 %becond = icmp ule i32 %iv.inc, %n
47 %and = select i1 true, i1 %becond, i1 false
48 br i1 %and, label %loop, label %leave
54 define void @unsimplified_and3(i32 %n) {
55 ; CHECK-LABEL: 'unsimplified_and3'
56 ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and3
57 ; CHECK-NEXT: Loop %loop: backedge-taken count is false
58 ; CHECK-NEXT: Loop %loop: max backedge-taken count is false
59 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false
60 ; CHECK-NEXT: Predicates:
61 ; CHECK: Loop %loop: Trip multiple is 1
67 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
68 %iv.inc = add nsw i32 %iv, 1
69 %becond = icmp ule i32 %iv.inc, %n
70 %and = select i1 false, i1 %becond, i1 false
71 br i1 %and, label %loop, label %leave
77 define void @unsimplified_and4(i32 %n) {
78 ; CHECK-LABEL: 'unsimplified_and4'
79 ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and4
80 ; CHECK-NEXT: Loop %loop: backedge-taken count is false
81 ; CHECK-NEXT: Loop %loop: max backedge-taken count is false
82 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false
83 ; CHECK-NEXT: Predicates:
84 ; CHECK: Loop %loop: Trip multiple is 1
90 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
91 %iv.inc = add nsw i32 %iv, 1
92 %becond = icmp ule i32 %iv.inc, %n
93 %and = select i1 %becond, i1 false, i1 false
94 br i1 %and, label %loop, label %leave
100 define void @unsimplified_or1(i32 %n) {
101 ; CHECK-LABEL: 'unsimplified_or1'
102 ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or1
103 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
104 ; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
105 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
111 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
112 %iv.inc = add nsw i32 %iv, 1
113 %becond = icmp ule i32 %iv.inc, %n
114 %or = select i1 %becond, i1 true, i1 true
115 br i1 %or, label %loop, label %leave
121 define void @unsimplified_or2(i32 %n) {
122 ; CHECK-LABEL: 'unsimplified_or2'
123 ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or2
124 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
125 ; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
126 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
132 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
133 %iv.inc = add nsw i32 %iv, 1
134 %becond = icmp ule i32 %iv.inc, %n
135 %or = select i1 true, i1 true, i1 %becond
136 br i1 %or, label %loop, label %leave
142 define void @unsimplified_or3(i32 %n) {
143 ; CHECK-LABEL: 'unsimplified_or3'
144 ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or3
145 ; CHECK-NEXT: Loop %loop: backedge-taken count is %n
146 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
147 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n
148 ; CHECK-NEXT: Predicates:
149 ; CHECK: Loop %loop: Trip multiple is 1
155 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
156 %iv.inc = add nsw i32 %iv, 1
157 %becond = icmp ule i32 %iv.inc, %n
158 %or = select i1 false, i1 true, i1 %becond
159 br i1 %or, label %loop, label %leave
165 define void @unsimplified_or4(i32 %n) {
166 ; CHECK-LABEL: 'unsimplified_or4'
167 ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or4
168 ; CHECK-NEXT: Loop %loop: backedge-taken count is %n
169 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
170 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n
171 ; CHECK-NEXT: Predicates:
172 ; CHECK: Loop %loop: Trip multiple is 1
178 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
179 %iv.inc = add nsw i32 %iv, 1
180 %becond = icmp ule i32 %iv.inc, %n
181 %or = select i1 %becond, i1 true, i1 false
182 br i1 %or, label %loop, label %leave
188 define void @reversed_and1(i32 %n) {
189 ; CHECK-LABEL: 'reversed_and1'
190 ; CHECK-NEXT: Determining loop execution counts for: @reversed_and1
191 ; CHECK-NEXT: Loop %loop: backedge-taken count is %n
192 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
193 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n
194 ; CHECK-NEXT: Predicates:
195 ; CHECK: Loop %loop: Trip multiple is 1
201 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
202 %iv.inc = add nsw i32 %iv, 1
203 %becond = icmp ugt i32 %iv.inc, %n
204 %and = select i1 %becond, i1 true, i1 false
205 br i1 %and, label %leave, label %loop
211 define void @reversed_and2(i32 %n) {
212 ; CHECK-LABEL: 'reversed_and2'
213 ; CHECK-NEXT: Determining loop execution counts for: @reversed_and2
214 ; CHECK-NEXT: Loop %loop: backedge-taken count is %n
215 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
216 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n
217 ; CHECK-NEXT: Predicates:
218 ; CHECK: Loop %loop: Trip multiple is 1
224 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
225 %iv.inc = add nsw i32 %iv, 1
226 %becond = icmp ugt i32 %iv.inc, %n
227 %and = select i1 true, i1 %becond, i1 false
228 br i1 %and, label %leave, label %loop
234 define void @reversed_and3(i32 %n) {
235 ; CHECK-LABEL: 'reversed_and3'
236 ; CHECK-NEXT: Determining loop execution counts for: @reversed_and3
237 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
238 ; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
239 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
245 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
246 %iv.inc = add nsw i32 %iv, 1
247 %becond = icmp ugt i32 %iv.inc, %n
248 %and = select i1 false, i1 %becond, i1 false
249 br i1 %and, label %leave, label %loop
255 define void @reversed_and4(i32 %n) {
256 ; CHECK-LABEL: 'reversed_and4'
257 ; CHECK-NEXT: Determining loop execution counts for: @reversed_and4
258 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
259 ; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
260 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
266 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
267 %iv.inc = add nsw i32 %iv, 1
268 %becond = icmp ugt i32 %iv.inc, %n
269 %and = select i1 %becond, i1 false, i1 false
270 br i1 %and, label %leave, label %loop
276 define void @reversed_or1(i32 %n) {
277 ; CHECK-LABEL: 'reversed_or1'
278 ; CHECK-NEXT: Determining loop execution counts for: @reversed_or1
279 ; CHECK-NEXT: Loop %loop: backedge-taken count is false
280 ; CHECK-NEXT: Loop %loop: max backedge-taken count is false
281 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false
282 ; CHECK-NEXT: Predicates:
283 ; CHECK: Loop %loop: Trip multiple is 1
289 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
290 %iv.inc = add nsw i32 %iv, 1
291 %becond = icmp ugt i32 %iv.inc, %n
292 %or = select i1 %becond, i1 true, i1 true
293 br i1 %or, label %leave, label %loop
299 define void @reversed_or2(i32 %n) {
300 ; CHECK-LABEL: 'reversed_or2'
301 ; CHECK-NEXT: Determining loop execution counts for: @reversed_or2
302 ; CHECK-NEXT: Loop %loop: backedge-taken count is false
303 ; CHECK-NEXT: Loop %loop: max backedge-taken count is false
304 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false
305 ; CHECK-NEXT: Predicates:
306 ; CHECK: Loop %loop: Trip multiple is 1
312 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
313 %iv.inc = add nsw i32 %iv, 1
314 %becond = icmp ugt i32 %iv.inc, %n
315 %or = select i1 true, i1 true, i1 %becond
316 br i1 %or, label %leave, label %loop
322 define void @reversed_or3(i32 %n) {
323 ; CHECK-LABEL: 'reversed_or3'
324 ; CHECK-NEXT: Determining loop execution counts for: @reversed_or3
325 ; CHECK-NEXT: Loop %loop: backedge-taken count is %n
326 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
327 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n
328 ; CHECK-NEXT: Predicates:
329 ; CHECK: Loop %loop: Trip multiple is 1
335 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
336 %iv.inc = add nsw i32 %iv, 1
337 %becond = icmp ugt i32 %iv.inc, %n
338 %or = select i1 false, i1 true, i1 %becond
339 br i1 %or, label %leave, label %loop
345 define void @reversed_or4(i32 %n) {
346 ; CHECK-LABEL: 'reversed_or4'
347 ; CHECK-NEXT: Determining loop execution counts for: @reversed_or4
348 ; CHECK-NEXT: Loop %loop: backedge-taken count is %n
349 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
350 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n
351 ; CHECK-NEXT: Predicates:
352 ; CHECK: Loop %loop: Trip multiple is 1
358 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
359 %iv.inc = add nsw i32 %iv, 1
360 %becond = icmp ugt i32 %iv.inc, %n
361 %or = select i1 %becond, i1 true, i1 false
362 br i1 %or, label %leave, label %loop