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 i32 @logical_and_2ops(i32 %n, i32 %m) {
5 ; CHECK-LABEL: 'logical_and_2ops'
6 ; CHECK-NEXT: Classifying expressions for: @logical_and_2ops
7 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
8 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m) LoopDispositions: { %loop: Computable }
9 ; CHECK-NEXT: %i.next = add i32 %i, 1
10 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m)) LoopDispositions: { %loop: Computable }
11 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
12 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
13 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_2ops
14 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m)
15 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
16 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m)
17 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m)
18 ; CHECK-NEXT: Predicates:
19 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
24 %i = phi i32 [0, %entry], [%i.next, %loop]
25 %i.next = add i32 %i, 1
26 %cond_p0 = icmp ult i32 %i, %n
27 %cond_p1 = icmp ult i32 %i, %m
28 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
29 br i1 %cond, label %loop, label %exit
34 define i32 @logical_or_2ops(i32 %n, i32 %m) {
35 ; CHECK-LABEL: 'logical_or_2ops'
36 ; CHECK-NEXT: Classifying expressions for: @logical_or_2ops
37 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
38 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m) LoopDispositions: { %loop: Computable }
39 ; CHECK-NEXT: %i.next = add i32 %i, 1
40 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m)) LoopDispositions: { %loop: Computable }
41 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 true, i1 %cond_p1
42 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
43 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_2ops
44 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m)
45 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
46 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m)
47 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m)
48 ; CHECK-NEXT: Predicates:
49 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
54 %i = phi i32 [0, %entry], [%i.next, %loop]
55 %i.next = add i32 %i, 1
56 %cond_p0 = icmp uge i32 %i, %n
57 %cond_p1 = icmp uge i32 %i, %m
58 %cond = select i1 %cond_p0, i1 true, i1 %cond_p1
59 br i1 %cond, label %exit, label %loop
64 define i32 @logical_and_3ops(i32 %n, i32 %m, i32 %k) {
65 ; CHECK-LABEL: 'logical_and_3ops'
66 ; CHECK-NEXT: Classifying expressions for: @logical_and_3ops
67 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
68 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m umin_seq %k) LoopDispositions: { %loop: Computable }
69 ; CHECK-NEXT: %i.next = add i32 %i, 1
70 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m umin_seq %k)) LoopDispositions: { %loop: Computable }
71 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 %cond_p1, i1 false
72 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
73 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 %cond_p2, i1 false
74 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1 umin_seq %cond_p2) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
75 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_3ops
76 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m umin_seq %k)
77 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
78 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m umin_seq %k)
79 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m umin_seq %k)
80 ; CHECK-NEXT: Predicates:
81 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
86 %i = phi i32 [0, %entry], [%i.next, %loop]
87 %i.next = add i32 %i, 1
88 %cond_p0 = icmp ult i32 %i, %n
89 %cond_p1 = icmp ult i32 %i, %m
90 %cond_p2 = icmp ult i32 %i, %k
91 %cond_p3 = select i1 %cond_p0, i1 %cond_p1, i1 false
92 %cond = select i1 %cond_p3, i1 %cond_p2, i1 false
93 br i1 %cond, label %loop, label %exit
98 define i32 @logical_or_3ops(i32 %n, i32 %m, i32 %k) {
99 ; CHECK-LABEL: 'logical_or_3ops'
100 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops
101 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
102 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m umin_seq %k) LoopDispositions: { %loop: Computable }
103 ; CHECK-NEXT: %i.next = add i32 %i, 1
104 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m umin_seq %k)) LoopDispositions: { %loop: Computable }
105 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
106 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
107 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
108 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1) umin_seq (true + %cond_p2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
109 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops
110 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m umin_seq %k)
111 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
112 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m umin_seq %k)
113 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m umin_seq %k)
114 ; CHECK-NEXT: Predicates:
115 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
120 %i = phi i32 [0, %entry], [%i.next, %loop]
121 %i.next = add i32 %i, 1
122 %cond_p0 = icmp uge i32 %i, %n
123 %cond_p1 = icmp uge i32 %i, %m
124 %cond_p2 = icmp uge i32 %i, %k
125 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
126 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
127 br i1 %cond, label %exit, label %loop
132 define i32 @logical_or_3ops_duplicate(i32 %n, i32 %m, i32 %k) {
133 ; CHECK-LABEL: 'logical_or_3ops_duplicate'
134 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_duplicate
135 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
136 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m umin_seq %k) LoopDispositions: { %loop: Computable }
137 ; CHECK-NEXT: %i.next = add i32 %i, 1
138 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m umin_seq %k)) LoopDispositions: { %loop: Computable }
139 ; CHECK-NEXT: %cond_p4 = select i1 %cond_p0, i1 true, i1 %cond_p1
140 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
141 ; CHECK-NEXT: %cond_p5 = select i1 %cond_p4, i1 true, i1 %cond_p2
142 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq ((true + %cond_p1) umin (true + %cond_p2)))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
143 ; CHECK-NEXT: %cond = select i1 %cond_p5, i1 true, i1 %cond_p3
144 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq ((true + %cond_p1) umin (true + %cond_p2)) umin_seq (true + %cond_p3))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
145 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_duplicate
146 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m umin_seq %k)
147 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
148 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m umin_seq %k)
149 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m umin_seq %k)
150 ; CHECK-NEXT: Predicates:
151 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
156 %i = phi i32 [0, %entry], [%i.next, %loop]
157 %i.next = add i32 %i, 1
158 %cond_p0 = icmp uge i32 %i, %n
159 %cond_p1 = icmp uge i32 %i, %m
160 %cond_p2 = icmp uge i32 %i, %n
161 %cond_p3 = icmp uge i32 %i, %k
162 %cond_p4 = select i1 %cond_p0, i1 true, i1 %cond_p1
163 %cond_p5 = select i1 %cond_p4, i1 true, i1 %cond_p2
164 %cond = select i1 %cond_p5, i1 true, i1 %cond_p3
165 br i1 %cond, label %exit, label %loop
170 define i32 @logical_or_3ops_redundant_uminseq_operand(i32 %n, i32 %m, i32 %k) {
171 ; CHECK-LABEL: 'logical_or_3ops_redundant_uminseq_operand'
172 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_redundant_uminseq_operand
173 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
174 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n umin %m) umin_seq %k) LoopDispositions: { %loop: Computable }
175 ; CHECK-NEXT: %i.next = add i32 %i, 1
176 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n umin %m) umin_seq %k)) LoopDispositions: { %loop: Computable }
177 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
178 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
179 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
180 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
181 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
182 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1) umin_seq (true + %cond_p2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
183 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_redundant_uminseq_operand
184 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n umin %m) umin_seq %k)
185 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
186 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n umin %m) umin_seq %k)
187 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n umin %m) umin_seq %k)
188 ; CHECK-NEXT: Predicates:
189 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
194 %i = phi i32 [0, %entry], [%i.next, %loop]
195 %i.next = add i32 %i, 1
196 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
197 %cond_p0 = icmp uge i32 %i, %umin
198 %cond_p1 = icmp uge i32 %i, %n
199 %cond_p2 = icmp uge i32 %i, %k
200 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
201 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
202 br i1 %cond, label %exit, label %loop
207 define i32 @logical_or_3ops_redundant_umin_operand(i32 %n, i32 %m, i32 %k) {
208 ; CHECK-LABEL: 'logical_or_3ops_redundant_umin_operand'
209 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_redundant_umin_operand
210 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
211 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %k umin_seq %m) LoopDispositions: { %loop: Computable }
212 ; CHECK-NEXT: %i.next = add i32 %i, 1
213 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %k umin_seq %m)) LoopDispositions: { %loop: Computable }
214 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
215 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
216 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
217 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
218 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
219 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1) umin_seq (true + %cond_p2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
220 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_redundant_umin_operand
221 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %k umin_seq %m)
222 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
223 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %k umin_seq %m)
224 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %k umin_seq %m)
225 ; CHECK-NEXT: Predicates:
226 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
231 %i = phi i32 [0, %entry], [%i.next, %loop]
232 %i.next = add i32 %i, 1
233 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
234 %cond_p0 = icmp uge i32 %i, %n
235 %cond_p1 = icmp uge i32 %i, %k
236 %cond_p2 = icmp uge i32 %i, %umin
237 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
238 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
239 br i1 %cond, label %exit, label %loop
244 define i32 @logical_or_4ops_redundant_operand_across_umins(i32 %n, i32 %m, i32 %k, i32 %q) {
245 ; CHECK-LABEL: 'logical_or_4ops_redundant_operand_across_umins'
246 ; CHECK-NEXT: Classifying expressions for: @logical_or_4ops_redundant_operand_across_umins
247 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
248 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n umin %m) umin_seq %k umin_seq %q) LoopDispositions: { %loop: Computable }
249 ; CHECK-NEXT: %i.next = add i32 %i, 1
250 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n umin %m) umin_seq %k umin_seq %q)) LoopDispositions: { %loop: Computable }
251 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
252 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
253 ; CHECK-NEXT: %umin2 = call i32 @llvm.umin.i32(i32 %n, i32 %q)
254 ; CHECK-NEXT: --> (%n umin %q) U: full-set S: full-set Exits: (%n umin %q) LoopDispositions: { %loop: Invariant }
255 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
256 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
257 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
258 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1) umin_seq (true + %cond_p2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
259 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_4ops_redundant_operand_across_umins
260 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n umin %m) umin_seq %k umin_seq %q)
261 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
262 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n umin %m) umin_seq %k umin_seq %q)
263 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n umin %m) umin_seq %k umin_seq %q)
264 ; CHECK-NEXT: Predicates:
265 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
270 %i = phi i32 [0, %entry], [%i.next, %loop]
271 %i.next = add i32 %i, 1
272 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
273 %umin2 = call i32 @llvm.umin.i32(i32 %n, i32 %q)
274 %cond_p0 = icmp uge i32 %i, %umin
275 %cond_p1 = icmp uge i32 %i, %k
276 %cond_p2 = icmp uge i32 %i, %umin2
277 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
278 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
279 br i1 %cond, label %exit, label %loop
284 define i32 @logical_or_3ops_operand_wise_redundant_umin(i32 %n, i32 %m, i32 %k) {
285 ; CHECK-LABEL: 'logical_or_3ops_operand_wise_redundant_umin'
286 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_operand_wise_redundant_umin
287 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
288 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n umin %m) umin_seq %k) LoopDispositions: { %loop: Computable }
289 ; CHECK-NEXT: %i.next = add i32 %i, 1
290 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n umin %m) umin_seq %k)) LoopDispositions: { %loop: Computable }
291 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
292 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
293 ; CHECK-NEXT: %umin2 = call i32 @llvm.umin.i32(i32 %n, i32 %k)
294 ; CHECK-NEXT: --> (%n umin %k) U: full-set S: full-set Exits: (%n umin %k) LoopDispositions: { %loop: Invariant }
295 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
296 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
297 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
298 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1) umin_seq (true + %cond_p2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
299 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_operand_wise_redundant_umin
300 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n umin %m) umin_seq %k)
301 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
302 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n umin %m) umin_seq %k)
303 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n umin %m) umin_seq %k)
304 ; CHECK-NEXT: Predicates:
305 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
310 %i = phi i32 [0, %entry], [%i.next, %loop]
311 %i.next = add i32 %i, 1
312 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
313 %umin2 = call i32 @llvm.umin.i32(i32 %n, i32 %k)
314 %cond_p0 = icmp uge i32 %i, %umin
315 %cond_p1 = icmp uge i32 %i, %k
316 %cond_p2 = icmp uge i32 %i, %umin2
317 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
318 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
319 br i1 %cond, label %exit, label %loop
324 define i32 @logical_or_3ops_partially_redundant_umin(i32 %n, i32 %m, i32 %k) {
325 ; CHECK-LABEL: 'logical_or_3ops_partially_redundant_umin'
326 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_partially_redundant_umin
327 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
328 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq (%m umin %k)) LoopDispositions: { %loop: Computable }
329 ; CHECK-NEXT: %i.next = add i32 %i, 1
330 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq (%m umin %k))) LoopDispositions: { %loop: Computable }
331 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
332 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
333 ; CHECK-NEXT: %umin2 = call i32 @llvm.umin.i32(i32 %umin, i32 %k)
334 ; CHECK-NEXT: --> (%n umin %m umin %k) U: full-set S: full-set Exits: (%n umin %m umin %k) LoopDispositions: { %loop: Invariant }
335 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 true, i1 %cond_p1
336 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
337 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_partially_redundant_umin
338 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq (%m umin %k))
339 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
340 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq (%m umin %k))
341 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq (%m umin %k))
342 ; CHECK-NEXT: Predicates:
343 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
348 %i = phi i32 [0, %entry], [%i.next, %loop]
349 %i.next = add i32 %i, 1
350 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
351 %umin2 = call i32 @llvm.umin.i32(i32 %umin, i32 %k)
352 %cond_p0 = icmp uge i32 %i, %n
353 %cond_p1 = icmp uge i32 %i, %umin2
354 %cond = select i1 %cond_p0, i1 true, i1 %cond_p1
355 br i1 %cond, label %exit, label %loop
360 define i32 @logical_or_5ops_redundant_opearand_of_inner_uminseq(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) {
361 ; CHECK-LABEL: 'logical_or_5ops_redundant_opearand_of_inner_uminseq'
362 ; CHECK-NEXT: Classifying expressions for: @logical_or_5ops_redundant_opearand_of_inner_uminseq
363 ; CHECK-NEXT: %first.i = phi i32 [ 0, %entry ], [ %first.i.next, %first.loop ]
364 ; CHECK-NEXT: --> {0,+,1}<%first.loop> U: full-set S: full-set Exits: (%e umin_seq %d umin_seq %a) LoopDispositions: { %first.loop: Computable }
365 ; CHECK-NEXT: %first.i.next = add i32 %first.i, 1
366 ; CHECK-NEXT: --> {1,+,1}<%first.loop> U: full-set S: full-set Exits: (1 + (%e umin_seq %d umin_seq %a)) LoopDispositions: { %first.loop: Computable }
367 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
368 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %first.loop: Variant }
369 ; CHECK-NEXT: %cond_p4 = select i1 %cond_p3, i1 true, i1 %cond_p2
370 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1) umin_seq (true + %cond_p2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %first.loop: Variant }
371 ; CHECK-NEXT: %i = phi i32 [ 0, %first.loop.exit ], [ %i.next, %loop ]
372 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%a umin_seq %b umin_seq ((%e umin_seq %d) umin %c)) LoopDispositions: { %loop: Computable }
373 ; CHECK-NEXT: %i.next = add i32 %i, 1
374 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%a umin_seq %b umin_seq ((%e umin_seq %d) umin %c))) LoopDispositions: { %loop: Computable }
375 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %c, i32 %d)
376 ; CHECK-NEXT: --> (%c umin %d) U: full-set S: full-set Exits: (%c umin %d) LoopDispositions: { %loop: Invariant }
377 ; CHECK-NEXT: %umin2 = call i32 @llvm.umin.i32(i32 %umin, i32 %first.i)
378 ; CHECK-NEXT: --> ({0,+,1}<%first.loop> umin %c umin %d) U: full-set S: full-set --> ((%e umin_seq %d umin_seq %a) umin %c umin %d) U: full-set S: full-set Exits: ((%e umin_seq %d umin_seq %a) umin %c umin %d) LoopDispositions: { %loop: Invariant }
379 ; CHECK-NEXT: %cond_p8 = select i1 %cond_p5, i1 true, i1 %cond_p6
380 ; CHECK-NEXT: --> (true + ((true + %cond_p5) umin_seq (true + %cond_p6))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
381 ; CHECK-NEXT: %cond = select i1 %cond_p8, i1 true, i1 %cond_p7
382 ; CHECK-NEXT: --> (true + ((true + %cond_p5) umin_seq (true + %cond_p6) umin_seq (true + %cond_p7))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
383 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_5ops_redundant_opearand_of_inner_uminseq
384 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%a umin_seq %b umin_seq ((%e umin_seq %d) umin %c))
385 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
386 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%a umin_seq %b umin_seq ((%e umin_seq %d) umin %c))
387 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%a umin_seq %b umin_seq ((%e umin_seq %d) umin %c))
388 ; CHECK-NEXT: Predicates:
389 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
390 ; CHECK-NEXT: Loop %first.loop: backedge-taken count is (%e umin_seq %d umin_seq %a)
391 ; CHECK-NEXT: Loop %first.loop: constant max backedge-taken count is -1
392 ; CHECK-NEXT: Loop %first.loop: symbolic max backedge-taken count is (%e umin_seq %d umin_seq %a)
393 ; CHECK-NEXT: Loop %first.loop: Predicated backedge-taken count is (%e umin_seq %d umin_seq %a)
394 ; CHECK-NEXT: Predicates:
395 ; CHECK-NEXT: Loop %first.loop: Trip multiple is 1
400 %first.i = phi i32 [0, %entry], [%first.i.next, %first.loop]
401 %first.i.next = add i32 %first.i, 1
402 %cond_p0 = icmp uge i32 %first.i, %e
403 %cond_p1 = icmp uge i32 %first.i, %d
404 %cond_p2 = icmp uge i32 %first.i, %a
405 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
406 %cond_p4 = select i1 %cond_p3, i1 true, i1 %cond_p2
407 br i1 %cond_p4, label %first.loop.exit, label %first.loop
411 %i = phi i32 [0, %first.loop.exit], [%i.next, %loop]
412 %i.next = add i32 %i, 1
413 %umin = call i32 @llvm.umin.i32(i32 %c, i32 %d)
414 %umin2 = call i32 @llvm.umin.i32(i32 %umin, i32 %first.i)
415 %cond_p5 = icmp uge i32 %i, %a
416 %cond_p6 = icmp uge i32 %i, %b
417 %cond_p7 = icmp uge i32 %i, %umin2
418 %cond_p8 = select i1 %cond_p5, i1 true, i1 %cond_p6
419 %cond = select i1 %cond_p8, i1 true, i1 %cond_p7
420 br i1 %cond, label %exit, label %loop
425 define i32 @logical_and_2ops_and_constant(i32 %n, i32 %m, i32 %k) {
426 ; CHECK-LABEL: 'logical_and_2ops_and_constant'
427 ; CHECK-NEXT: Classifying expressions for: @logical_and_2ops_and_constant
428 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
429 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,43) S: [0,43) Exits: (42 umin %n) LoopDispositions: { %loop: Computable }
430 ; CHECK-NEXT: %i.next = add i32 %i, 1
431 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,44) S: [1,44) Exits: (1 + (42 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
432 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 42)
433 ; CHECK-NEXT: --> (42 umin %n) U: [0,43) S: [0,43) Exits: (42 umin %n) LoopDispositions: { %loop: Invariant }
434 ; CHECK-NEXT: %cond = select i1 %cond_p1, i1 true, i1 %cond_p0
435 ; CHECK-NEXT: --> (true + ((true + %cond_p1) umin (true + %cond_p0))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
436 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_2ops_and_constant
437 ; CHECK-NEXT: Loop %loop: backedge-taken count is (42 umin %n)
438 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 42
439 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (42 umin %n)
440 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (42 umin %n)
441 ; CHECK-NEXT: Predicates:
442 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
447 %i = phi i32 [0, %entry], [%i.next, %loop]
448 %i.next = add i32 %i, 1
449 %umin = call i32 @llvm.umin.i32(i32 %n, i32 42)
450 %cond_p0 = icmp uge i32 %i, %umin
451 %cond_p1 = icmp uge i32 %i, %n
452 %cond = select i1 %cond_p1, i1 true, i1 %cond_p0
453 br i1 %cond, label %exit, label %loop
458 define i32 @computeSCEVAtScope(i32 %d.0) {
459 ; CHECK-LABEL: 'computeSCEVAtScope'
460 ; CHECK-NEXT: Classifying expressions for: @computeSCEVAtScope
461 ; CHECK-NEXT: %d.1 = phi i32 [ %inc, %for.body ], [ %d.0, %for.cond.preheader ]
462 ; CHECK-NEXT: --> {%d.0,+,1}<nsw><%for.cond> U: full-set S: full-set Exits: 0 LoopDispositions: { %for.cond: Computable, %while.cond: Variant }
463 ; CHECK-NEXT: %e.1 = phi i32 [ %inc3, %for.body ], [ %d.0, %for.cond.preheader ]
464 ; CHECK-NEXT: --> {%d.0,+,1}<nsw><%for.cond> U: full-set S: full-set Exits: 0 LoopDispositions: { %for.cond: Computable, %while.cond: Variant }
465 ; CHECK-NEXT: %0 = select i1 %tobool1, i1 %tobool2, i1 false
466 ; CHECK-NEXT: --> (%tobool1 umin_seq %tobool2) U: full-set S: full-set Exits: false LoopDispositions: { %for.cond: Variant, %while.cond: Variant }
467 ; CHECK-NEXT: %inc = add nsw i32 %d.1, 1
468 ; CHECK-NEXT: --> {(1 + %d.0),+,1}<nw><%for.cond> U: full-set S: full-set Exits: 1 LoopDispositions: { %for.cond: Computable, %while.cond: Variant }
469 ; CHECK-NEXT: %inc3 = add nsw i32 %e.1, 1
470 ; CHECK-NEXT: --> {(1 + %d.0),+,1}<nw><%for.cond> U: full-set S: full-set Exits: 1 LoopDispositions: { %for.cond: Computable, %while.cond: Variant }
471 ; CHECK-NEXT: %f.1 = phi i32 [ %inc8, %for.body5 ], [ 0, %for.cond4.preheader ]
472 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%for.cond4> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %for.cond4: Computable, %while.cond: Variant }
473 ; CHECK-NEXT: %inc8 = add i32 %f.1, 1
474 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%for.cond4> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %for.cond4: Computable, %while.cond: Variant }
475 ; CHECK-NEXT: Determining loop execution counts for: @computeSCEVAtScope
476 ; CHECK-NEXT: Loop %for.cond: backedge-taken count is (-1 * %d.0)
477 ; CHECK-NEXT: Loop %for.cond: constant max backedge-taken count is -1
478 ; CHECK-NEXT: Loop %for.cond: symbolic max backedge-taken count is (-1 * %d.0)
479 ; CHECK-NEXT: Loop %for.cond: Predicated backedge-taken count is (-1 * %d.0)
480 ; CHECK-NEXT: Predicates:
481 ; CHECK-NEXT: Loop %for.cond: Trip multiple is 1
482 ; CHECK-NEXT: Loop %for.cond4: backedge-taken count is 0
483 ; CHECK-NEXT: Loop %for.cond4: constant max backedge-taken count is 0
484 ; CHECK-NEXT: Loop %for.cond4: symbolic max backedge-taken count is 0
485 ; CHECK-NEXT: Loop %for.cond4: Predicated backedge-taken count is 0
486 ; CHECK-NEXT: Predicates:
487 ; CHECK-NEXT: Loop %for.cond4: Trip multiple is 1
488 ; CHECK-NEXT: Loop %while.cond: <multiple exits> Unpredictable backedge-taken count.
489 ; CHECK-NEXT: Loop %while.cond: Unpredictable constant max backedge-taken count.
490 ; CHECK-NEXT: Loop %while.cond: Unpredictable symbolic max backedge-taken count.
491 ; CHECK-NEXT: Loop %while.cond: Unpredictable predicated backedge-taken count.
496 while.cond.loopexit: ; preds = %for.cond4
499 while.cond: ; preds = %while.cond.loopexit, %entry
500 br label %for.cond.preheader
502 for.cond.preheader: ; preds = %while.cond
505 for.cond: ; preds = %for.body, %for.cond.preheader
506 %d.1 = phi i32 [ %inc, %for.body ], [ %d.0, %for.cond.preheader ]
507 %e.1 = phi i32 [ %inc3, %for.body ], [ %d.0, %for.cond.preheader ]
508 %tobool1 = icmp ne i32 %e.1, 0
509 %tobool2 = icmp ne i32 %d.1, 0
510 %0 = select i1 %tobool1, i1 %tobool2, i1 false
511 br i1 %0, label %for.body, label %for.cond4.preheader
513 for.cond4.preheader: ; preds = %for.cond
516 for.body: ; preds = %for.cond
517 %inc = add nsw i32 %d.1, 1
518 %inc3 = add nsw i32 %e.1, 1
521 for.cond4: ; preds = %for.body5, %for.cond4.preheader
522 %f.1 = phi i32 [ %inc8, %for.body5 ], [ 0, %for.cond4.preheader ]
523 %exitcond.not = icmp eq i32 %f.1, %e.1
524 br i1 %exitcond.not, label %while.cond.loopexit, label %for.body5
526 for.body5: ; preds = %for.cond4
527 %inc8 = add i32 %f.1, 1
531 define i64 @uminseq_vs_ptrtoint_complexity(i64 %n, i64 %m, ptr %ptr) {
532 ; CHECK-LABEL: 'uminseq_vs_ptrtoint_complexity'
533 ; CHECK-NEXT: Classifying expressions for: @uminseq_vs_ptrtoint_complexity
534 ; CHECK-NEXT: %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
535 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m) LoopDispositions: { %loop: Computable }
536 ; CHECK-NEXT: %i.next = add i64 %i, 1
537 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m)) LoopDispositions: { %loop: Computable }
538 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
539 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
540 ; CHECK-NEXT: %ptr.int = ptrtoint ptr %ptr to i64
541 ; CHECK-NEXT: --> (ptrtoint ptr %ptr to i64) U: full-set S: full-set
542 ; CHECK-NEXT: %r = add i64 %i, %ptr.int
543 ; CHECK-NEXT: --> {(ptrtoint ptr %ptr to i64),+,1}<%loop> U: full-set S: full-set --> ((%n umin_seq %m) + (ptrtoint ptr %ptr to i64)) U: full-set S: full-set
544 ; CHECK-NEXT: Determining loop execution counts for: @uminseq_vs_ptrtoint_complexity
545 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m)
546 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
547 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m)
548 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m)
549 ; CHECK-NEXT: Predicates:
550 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
555 %i = phi i64 [0, %entry], [%i.next, %loop]
556 %i.next = add i64 %i, 1
557 %cond_p0 = icmp ult i64 %i, %n
558 %cond_p1 = icmp ult i64 %i, %m
559 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
560 br i1 %cond, label %loop, label %exit
562 %ptr.int = ptrtoint ptr %ptr to i64
563 %r = add i64 %i, %ptr.int
567 define i32 @logical_and_implies_poison1(i32 %n) {
568 ; CHECK-LABEL: 'logical_and_implies_poison1'
569 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison1
570 ; CHECK-NEXT: %add = add i32 %n, 1
571 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
572 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
573 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((1 + %n) umin %n) LoopDispositions: { %loop: Computable }
574 ; CHECK-NEXT: %i.next = add i32 %i, 1
575 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((1 + %n) umin %n)) LoopDispositions: { %loop: Computable }
576 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
577 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
578 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison1
579 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((1 + %n) umin %n)
580 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
581 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((1 + %n) umin %n)
582 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((1 + %n) umin %n)
583 ; CHECK-NEXT: Predicates:
584 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
590 %i = phi i32 [0, %entry], [%i.next, %loop]
591 %i.next = add i32 %i, 1
592 %cond_p0 = icmp ult i32 %i, %n
593 %cond_p1 = icmp ult i32 %i, %add
594 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
595 br i1 %cond, label %loop, label %exit
600 define i32 @logical_and_implies_poison2(i32 %n) {
601 ; CHECK-LABEL: 'logical_and_implies_poison2'
602 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison2
603 ; CHECK-NEXT: %add = add i32 %n, 1
604 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
605 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
606 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((1 + %n) umin %n) LoopDispositions: { %loop: Computable }
607 ; CHECK-NEXT: %i.next = add i32 %i, 1
608 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((1 + %n) umin %n)) LoopDispositions: { %loop: Computable }
609 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
610 ; CHECK-NEXT: --> (%cond_p1 umin %cond_p0) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
611 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison2
612 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((1 + %n) umin %n)
613 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
614 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((1 + %n) umin %n)
615 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((1 + %n) umin %n)
616 ; CHECK-NEXT: Predicates:
617 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
623 %i = phi i32 [0, %entry], [%i.next, %loop]
624 %i.next = add i32 %i, 1
625 %cond_p0 = icmp ult i32 %i, %add
626 %cond_p1 = icmp ult i32 %i, %n
627 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
628 br i1 %cond, label %loop, label %exit
633 define i32 @logical_and_implies_poison3(i32 %n, i32 %m) {
634 ; CHECK-LABEL: 'logical_and_implies_poison3'
635 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison3
636 ; CHECK-NEXT: %add = add i32 %n, %m
637 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
638 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
639 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n + %m) umin %n) LoopDispositions: { %loop: Computable }
640 ; CHECK-NEXT: %i.next = add i32 %i, 1
641 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n + %m) umin %n)) LoopDispositions: { %loop: Computable }
642 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
643 ; CHECK-NEXT: --> (%cond_p1 umin %cond_p0) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
644 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison3
645 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n + %m) umin %n)
646 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
647 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin %n)
648 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n + %m) umin %n)
649 ; CHECK-NEXT: Predicates:
650 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
653 %add = add i32 %n, %m
656 %i = phi i32 [0, %entry], [%i.next, %loop]
657 %i.next = add i32 %i, 1
658 %cond_p0 = icmp ult i32 %i, %add
659 %cond_p1 = icmp ult i32 %i, %n
660 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
661 br i1 %cond, label %loop, label %exit
666 define i32 @logical_and_implies_poison_wrong_direction(i32 %n, i32 %m) {
667 ; CHECK-LABEL: 'logical_and_implies_poison_wrong_direction'
668 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_wrong_direction
669 ; CHECK-NEXT: %add = add i32 %n, %m
670 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
671 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
672 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq (%n + %m)) LoopDispositions: { %loop: Computable }
673 ; CHECK-NEXT: %i.next = add i32 %i, 1
674 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq (%n + %m))) LoopDispositions: { %loop: Computable }
675 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
676 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
677 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_wrong_direction
678 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq (%n + %m))
679 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
680 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq (%n + %m))
681 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq (%n + %m))
682 ; CHECK-NEXT: Predicates:
683 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
686 %add = add i32 %n, %m
689 %i = phi i32 [0, %entry], [%i.next, %loop]
690 %i.next = add i32 %i, 1
691 %cond_p0 = icmp ult i32 %i, %n
692 %cond_p1 = icmp ult i32 %i, %add
693 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
694 br i1 %cond, label %loop, label %exit
699 define i32 @logical_and_implies_poison_noundef(i32 %n, i32 noundef %m) {
700 ; CHECK-LABEL: 'logical_and_implies_poison_noundef'
701 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_noundef
702 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
703 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Computable }
704 ; CHECK-NEXT: %i.next = add i32 %i, 1
705 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin %m)) LoopDispositions: { %loop: Computable }
706 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
707 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
708 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_noundef
709 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin %m)
710 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
711 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin %m)
712 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin %m)
713 ; CHECK-NEXT: Predicates:
714 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
719 %i = phi i32 [0, %entry], [%i.next, %loop]
720 %i.next = add i32 %i, 1
721 %cond_p0 = icmp ult i32 %i, %n
722 %cond_p1 = icmp ult i32 %i, %m
723 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
724 br i1 %cond, label %loop, label %exit
729 define i32 @logical_and_implies_poison_noundef_wrong_direction(i32 %n, i32 noundef %m) {
730 ; CHECK-LABEL: 'logical_and_implies_poison_noundef_wrong_direction'
731 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_noundef_wrong_direction
732 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
733 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%m umin_seq %n) LoopDispositions: { %loop: Computable }
734 ; CHECK-NEXT: %i.next = add i32 %i, 1
735 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%m umin_seq %n)) LoopDispositions: { %loop: Computable }
736 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
737 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
738 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_noundef_wrong_direction
739 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%m umin_seq %n)
740 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
741 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%m umin_seq %n)
742 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%m umin_seq %n)
743 ; CHECK-NEXT: Predicates:
744 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
749 %i = phi i32 [0, %entry], [%i.next, %loop]
750 %i.next = add i32 %i, 1
751 %cond_p0 = icmp ult i32 %i, %m
752 %cond_p1 = icmp ult i32 %i, %n
753 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
754 br i1 %cond, label %loop, label %exit
759 define i32 @logical_and_implies_poison_complex1(i32 %n, i32 %m) {
760 ; CHECK-LABEL: 'logical_and_implies_poison_complex1'
761 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_complex1
762 ; CHECK-NEXT: %add = add i32 %n, %m
763 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
764 ; CHECK-NEXT: %add1 = add i32 %add, 1
765 ; CHECK-NEXT: --> (1 + %n + %m) U: full-set S: full-set
766 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
767 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n + %m) umin (1 + %n + %m)) LoopDispositions: { %loop: Computable }
768 ; CHECK-NEXT: %i.next = add i32 %i, 1
769 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n + %m) umin (1 + %n + %m))) LoopDispositions: { %loop: Computable }
770 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
771 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
772 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_complex1
773 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n + %m) umin (1 + %n + %m))
774 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
775 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin (1 + %n + %m))
776 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n + %m) umin (1 + %n + %m))
777 ; CHECK-NEXT: Predicates:
778 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
781 %add = add i32 %n, %m
782 %add1 = add i32 %add, 1
785 %i = phi i32 [0, %entry], [%i.next, %loop]
786 %i.next = add i32 %i, 1
787 %cond_p0 = icmp ult i32 %i, %add1
788 %cond_p1 = icmp ult i32 %i, %add
789 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
790 br i1 %cond, label %loop, label %exit
795 define i32 @logical_and_implies_poison_complex2(i32 %n, i32 %m, i32 %l) {
796 ; CHECK-LABEL: 'logical_and_implies_poison_complex2'
797 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_complex2
798 ; CHECK-NEXT: %add = add i32 %n, %m
799 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
800 ; CHECK-NEXT: %add1 = add i32 %add, %l
801 ; CHECK-NEXT: --> (%n + %m + %l) U: full-set S: full-set
802 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
803 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n + %m) umin (%n + %m + %l)) LoopDispositions: { %loop: Computable }
804 ; CHECK-NEXT: %i.next = add i32 %i, 1
805 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n + %m) umin (%n + %m + %l))) LoopDispositions: { %loop: Computable }
806 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
807 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
808 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_complex2
809 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n + %m) umin (%n + %m + %l))
810 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
811 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin (%n + %m + %l))
812 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n + %m) umin (%n + %m + %l))
813 ; CHECK-NEXT: Predicates:
814 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
817 %add = add i32 %n, %m
818 %add1 = add i32 %add, %l
821 %i = phi i32 [0, %entry], [%i.next, %loop]
822 %i.next = add i32 %i, 1
823 %cond_p0 = icmp ult i32 %i, %add1
824 %cond_p1 = icmp ult i32 %i, %add
825 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
826 br i1 %cond, label %loop, label %exit
831 define i32 @logical_and_implies_poison_complex_wrong_direction(i32 %n, i32 %m, i32 %l) {
832 ; CHECK-LABEL: 'logical_and_implies_poison_complex_wrong_direction'
833 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_complex_wrong_direction
834 ; CHECK-NEXT: %add = add i32 %n, %m
835 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
836 ; CHECK-NEXT: %add1 = add i32 %add, %l
837 ; CHECK-NEXT: --> (%n + %m + %l) U: full-set S: full-set
838 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
839 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n + %m) umin_seq (%n + %m + %l)) LoopDispositions: { %loop: Computable }
840 ; CHECK-NEXT: %i.next = add i32 %i, 1
841 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n + %m) umin_seq (%n + %m + %l))) LoopDispositions: { %loop: Computable }
842 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
843 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
844 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_complex_wrong_direction
845 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n + %m) umin_seq (%n + %m + %l))
846 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
847 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin_seq (%n + %m + %l))
848 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((%n + %m) umin_seq (%n + %m + %l))
849 ; CHECK-NEXT: Predicates:
850 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
853 %add = add i32 %n, %m
854 %add1 = add i32 %add, %l
857 %i = phi i32 [0, %entry], [%i.next, %loop]
858 %i.next = add i32 %i, 1
859 %cond_p0 = icmp ult i32 %i, %add
860 %cond_p1 = icmp ult i32 %i, %add1
861 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
862 br i1 %cond, label %loop, label %exit
867 define i32 @logical_and_implies_multiple_ops(i32 %n, i32 %m) {
868 ; CHECK-LABEL: 'logical_and_implies_multiple_ops'
869 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_multiple_ops
870 ; CHECK-NEXT: %add = add i32 %n, 1
871 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
872 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
873 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (((1 + %n) umin %n) umin_seq %m) LoopDispositions: { %loop: Computable }
874 ; CHECK-NEXT: %i.next = add i32 %i, 1
875 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (((1 + %n) umin %n) umin_seq %m)) LoopDispositions: { %loop: Computable }
876 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
877 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
878 ; CHECK-NEXT: %cond2 = select i1 %cond, i1 %cond_p2, i1 false
879 ; CHECK-NEXT: --> ((%cond_p0 umin %cond_p1) umin_seq %cond_p2) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
880 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_multiple_ops
881 ; CHECK-NEXT: Loop %loop: backedge-taken count is (((1 + %n) umin %n) umin_seq %m)
882 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
883 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (((1 + %n) umin %n) umin_seq %m)
884 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (((1 + %n) umin %n) umin_seq %m)
885 ; CHECK-NEXT: Predicates:
886 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
892 %i = phi i32 [0, %entry], [%i.next, %loop]
893 %i.next = add i32 %i, 1
894 %cond_p0 = icmp ult i32 %i, %n
895 %cond_p1 = icmp ult i32 %i, %add
896 %cond_p2 = icmp ult i32 %i, %m
897 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
898 %cond2 = select i1 %cond, i1 %cond_p2, i1 false
899 br i1 %cond2, label %loop, label %exit
904 define i32 @logical_and_implies_multiple_ops2(i32 %n, i32 %m) {
905 ; CHECK-LABEL: 'logical_and_implies_multiple_ops2'
906 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_multiple_ops2
907 ; CHECK-NEXT: %add = add i32 %n, 1
908 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
909 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
910 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq ((1 + %n) umin %m)) LoopDispositions: { %loop: Computable }
911 ; CHECK-NEXT: %i.next = add i32 %i, 1
912 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq ((1 + %n) umin %m))) LoopDispositions: { %loop: Computable }
913 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
914 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
915 ; CHECK-NEXT: %cond2 = select i1 %cond, i1 %cond_p2, i1 false
916 ; CHECK-NEXT: --> (%cond_p0 umin_seq (%cond_p1 umin %cond_p2)) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
917 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_multiple_ops2
918 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq ((1 + %n) umin %m))
919 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
920 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq ((1 + %n) umin %m))
921 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq ((1 + %n) umin %m))
922 ; CHECK-NEXT: Predicates:
923 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
929 %i = phi i32 [0, %entry], [%i.next, %loop]
930 %i.next = add i32 %i, 1
931 %cond_p0 = icmp ult i32 %i, %n
932 %cond_p1 = icmp ult i32 %i, %m
933 %cond_p2 = icmp ult i32 %i, %add
934 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
935 %cond2 = select i1 %cond, i1 %cond_p2, i1 false
936 br i1 %cond2, label %loop, label %exit
941 define i32 @logical_and_implies_multiple_ops3(i32 %n, i32 %m) {
942 ; CHECK-LABEL: 'logical_and_implies_multiple_ops3'
943 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_multiple_ops3
944 ; CHECK-NEXT: %add = add i32 %n, 1
945 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
946 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
947 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%m umin_seq ((1 + %n) umin %n)) LoopDispositions: { %loop: Computable }
948 ; CHECK-NEXT: %i.next = add i32 %i, 1
949 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%m umin_seq ((1 + %n) umin %n))) LoopDispositions: { %loop: Computable }
950 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
951 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
952 ; CHECK-NEXT: %cond2 = select i1 %cond, i1 %cond_p2, i1 false
953 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1 umin_seq %cond_p2) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
954 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_multiple_ops3
955 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%m umin_seq ((1 + %n) umin %n))
956 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
957 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%m umin_seq ((1 + %n) umin %n))
958 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%m umin_seq ((1 + %n) umin %n))
959 ; CHECK-NEXT: Predicates:
960 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
966 %i = phi i32 [0, %entry], [%i.next, %loop]
967 %i.next = add i32 %i, 1
968 %cond_p0 = icmp ult i32 %i, %m
969 %cond_p1 = icmp ult i32 %i, %n
970 %cond_p2 = icmp ult i32 %i, %add
971 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
972 %cond2 = select i1 %cond, i1 %cond_p2, i1 false
973 br i1 %cond2, label %loop, label %exit
978 define i32 @logical_and_not_zero(i16 %n, i32 %m) {
979 ; CHECK-LABEL: 'logical_and_not_zero'
980 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_zero
981 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
982 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
983 ; CHECK-NEXT: %n1 = add i32 %n.ext, 1
984 ; CHECK-NEXT: --> (1 + (zext i16 %n to i32))<nuw><nsw> U: [1,65537) S: [1,65537)
985 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
986 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65537) S: [0,65537) Exits: ((1 + (zext i16 %n to i32))<nuw><nsw> umin %m) LoopDispositions: { %loop: Computable }
987 ; CHECK-NEXT: %i.next = add i32 %i, 1
988 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,65538) S: [1,65538) Exits: (1 + ((1 + (zext i16 %n to i32))<nuw><nsw> umin %m))<nuw><nsw> LoopDispositions: { %loop: Computable }
989 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
990 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
991 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_zero
992 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((1 + (zext i16 %n to i32))<nuw><nsw> umin %m)
993 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 65536
994 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((1 + (zext i16 %n to i32))<nuw><nsw> umin %m)
995 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((1 + (zext i16 %n to i32))<nuw><nsw> umin %m)
996 ; CHECK-NEXT: Predicates:
997 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1000 %n.ext = zext i16 %n to i32
1001 %n1 = add i32 %n.ext, 1
1004 %i = phi i32 [0, %entry], [%i.next, %loop]
1005 %i.next = add i32 %i, 1
1006 %cond_p0 = icmp ult i32 %i, %n1
1007 %cond_p1 = icmp ult i32 %i, %m
1008 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1009 br i1 %cond, label %loop, label %exit
1014 define i32 @logical_and_not_zero_wrong_order(i16 %n, i32 %m) {
1015 ; CHECK-LABEL: 'logical_and_not_zero_wrong_order'
1016 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_zero_wrong_order
1017 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1018 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1019 ; CHECK-NEXT: %n1 = add i32 %n.ext, 1
1020 ; CHECK-NEXT: --> (1 + (zext i16 %n to i32))<nuw><nsw> U: [1,65537) S: [1,65537)
1021 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1022 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65537) S: [0,65537) Exits: (%m umin_seq (1 + (zext i16 %n to i32))<nuw><nsw>) LoopDispositions: { %loop: Computable }
1023 ; CHECK-NEXT: %i.next = add i32 %i, 1
1024 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,65538) S: [1,65538) Exits: (1 + (%m umin_seq (1 + (zext i16 %n to i32))<nuw><nsw>))<nuw><nsw> LoopDispositions: { %loop: Computable }
1025 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1026 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1027 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_zero_wrong_order
1028 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%m umin_seq (1 + (zext i16 %n to i32))<nuw><nsw>)
1029 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 65536
1030 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%m umin_seq (1 + (zext i16 %n to i32))<nuw><nsw>)
1031 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%m umin_seq (1 + (zext i16 %n to i32))<nuw><nsw>)
1032 ; CHECK-NEXT: Predicates:
1033 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1036 %n.ext = zext i16 %n to i32
1037 %n1 = add i32 %n.ext, 1
1040 %i = phi i32 [0, %entry], [%i.next, %loop]
1041 %i.next = add i32 %i, 1
1042 %cond_p0 = icmp ult i32 %i, %m
1043 %cond_p1 = icmp ult i32 %i, %n1
1044 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1045 br i1 %cond, label %loop, label %exit
1050 define i32 @logical_and_not_zero_needs_context(i32 %n, i32 %m) {
1051 ; CHECK-LABEL: 'logical_and_not_zero_needs_context'
1052 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_zero_needs_context
1053 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1054 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m) LoopDispositions: { %loop: Computable }
1055 ; CHECK-NEXT: %i.next = add i32 %i, 1
1056 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m)) LoopDispositions: { %loop: Computable }
1057 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1058 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1059 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_zero_needs_context
1060 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m)
1061 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is -1
1062 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m)
1063 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%n umin_seq %m)
1064 ; CHECK-NEXT: Predicates:
1065 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1068 %cmp = icmp ne i32 %n, 0
1069 br i1 %cmp, label %loop, label %guard.fail
1071 %i = phi i32 [0, %entry], [%i.next, %loop]
1072 %i.next = add i32 %i, 1
1073 %cond_p0 = icmp ult i32 %i, %n
1074 %cond_p1 = icmp ult i32 %i, %m
1075 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1076 br i1 %cond, label %loop, label %exit
1083 define i32 @logical_and_known_smaller(i16 %n, i16 %m) {
1084 ; CHECK-LABEL: 'logical_and_known_smaller'
1085 ; CHECK-NEXT: Classifying expressions for: @logical_and_known_smaller
1086 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1087 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1088 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1089 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1090 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65536
1091 ; CHECK-NEXT: --> (65536 + (zext i16 %m to i32))<nuw><nsw> U: [65536,131072) S: [65536,131072)
1092 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1093 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: (zext i16 %n to i32) LoopDispositions: { %loop: Computable }
1094 ; CHECK-NEXT: %i.next = add i32 %i, 1
1095 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,65537) S: [1,65537) Exits: (1 + (zext i16 %n to i32))<nuw><nsw> LoopDispositions: { %loop: Computable }
1096 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1097 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1098 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_known_smaller
1099 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i16 %n to i32)
1100 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 65535
1101 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32)
1102 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i16 %n to i32)
1103 ; CHECK-NEXT: Predicates:
1104 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1107 %n.ext = zext i16 %n to i32
1108 %m.ext = zext i16 %m to i32
1109 %m.add = add i32 %m.ext, 65536
1112 %i = phi i32 [0, %entry], [%i.next, %loop]
1113 %i.next = add i32 %i, 1
1114 %cond_p0 = icmp ult i32 %i, %n.ext
1115 %cond_p1 = icmp ult i32 %i, %m.add
1116 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1117 br i1 %cond, label %loop, label %exit
1122 define i32 @logical_and_known_smaller_equal(i16 %n, i16 %m) {
1123 ; CHECK-LABEL: 'logical_and_known_smaller_equal'
1124 ; CHECK-NEXT: Classifying expressions for: @logical_and_known_smaller_equal
1125 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1126 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1127 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1128 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1129 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65535
1130 ; CHECK-NEXT: --> (65535 + (zext i16 %m to i32))<nuw><nsw> U: [65535,131071) S: [65535,131071)
1131 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1132 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: (zext i16 %n to i32) LoopDispositions: { %loop: Computable }
1133 ; CHECK-NEXT: %i.next = add i32 %i, 1
1134 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,65537) S: [1,65537) Exits: (1 + (zext i16 %n to i32))<nuw><nsw> LoopDispositions: { %loop: Computable }
1135 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1136 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1137 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_known_smaller_equal
1138 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i16 %n to i32)
1139 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 65535
1140 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32)
1141 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i16 %n to i32)
1142 ; CHECK-NEXT: Predicates:
1143 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1146 %n.ext = zext i16 %n to i32
1147 %m.ext = zext i16 %m to i32
1148 %m.add = add i32 %m.ext, 65535
1151 %i = phi i32 [0, %entry], [%i.next, %loop]
1152 %i.next = add i32 %i, 1
1153 %cond_p0 = icmp ult i32 %i, %n.ext
1154 %cond_p1 = icmp ult i32 %i, %m.add
1155 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1156 br i1 %cond, label %loop, label %exit
1161 define i32 @logical_and_not_known_smaller_equal(i16 %n, i16 %m) {
1162 ; CHECK-LABEL: 'logical_and_not_known_smaller_equal'
1163 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_known_smaller_equal
1164 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1165 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1166 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1167 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1168 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65534
1169 ; CHECK-NEXT: --> (65534 + (zext i16 %m to i32))<nuw><nsw> U: [65534,131070) S: [65534,131070)
1170 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1171 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: ((zext i16 %n to i32) umin_seq (65534 + (zext i16 %m to i32))<nuw><nsw>) LoopDispositions: { %loop: Computable }
1172 ; CHECK-NEXT: %i.next = add i32 %i, 1
1173 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,65537) S: [1,65537) Exits: (1 + ((zext i16 %n to i32) umin_seq (65534 + (zext i16 %m to i32))<nuw><nsw>))<nuw><nsw> LoopDispositions: { %loop: Computable }
1174 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1175 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1176 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_known_smaller_equal
1177 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i16 %n to i32) umin_seq (65534 + (zext i16 %m to i32))<nuw><nsw>)
1178 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 65535
1179 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((zext i16 %n to i32) umin_seq (65534 + (zext i16 %m to i32))<nuw><nsw>)
1180 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i16 %n to i32) umin_seq (65534 + (zext i16 %m to i32))<nuw><nsw>)
1181 ; CHECK-NEXT: Predicates:
1182 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1185 %n.ext = zext i16 %n to i32
1186 %m.ext = zext i16 %m to i32
1187 %m.add = add i32 %m.ext, 65534
1190 %i = phi i32 [0, %entry], [%i.next, %loop]
1191 %i.next = add i32 %i, 1
1192 %cond_p0 = icmp ult i32 %i, %n.ext
1193 %cond_p1 = icmp ult i32 %i, %m.add
1194 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1195 br i1 %cond, label %loop, label %exit
1200 define i32 @logical_and_known_greater(i16 %n, i16 %m) {
1201 ; CHECK-LABEL: 'logical_and_known_greater'
1202 ; CHECK-NEXT: Classifying expressions for: @logical_and_known_greater
1203 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1204 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1205 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1206 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1207 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65536
1208 ; CHECK-NEXT: --> (65536 + (zext i16 %m to i32))<nuw><nsw> U: [65536,131072) S: [65536,131072)
1209 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1210 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: (zext i16 %n to i32) LoopDispositions: { %loop: Computable }
1211 ; CHECK-NEXT: %i.next = add i32 %i, 1
1212 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,65537) S: [1,65537) Exits: (1 + (zext i16 %n to i32))<nuw><nsw> LoopDispositions: { %loop: Computable }
1213 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1214 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1215 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_known_greater
1216 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i16 %n to i32)
1217 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 65535
1218 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32)
1219 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i16 %n to i32)
1220 ; CHECK-NEXT: Predicates:
1221 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1224 %n.ext = zext i16 %n to i32
1225 %m.ext = zext i16 %m to i32
1226 %m.add = add i32 %m.ext, 65536
1229 %i = phi i32 [0, %entry], [%i.next, %loop]
1230 %i.next = add i32 %i, 1
1231 %cond_p0 = icmp ult i32 %i, %m.add
1232 %cond_p1 = icmp ult i32 %i, %n.ext
1233 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1234 br i1 %cond, label %loop, label %exit
1239 define i32 @logical_and_known_greater_equal(i16 %n, i16 %m) {
1240 ; CHECK-LABEL: 'logical_and_known_greater_equal'
1241 ; CHECK-NEXT: Classifying expressions for: @logical_and_known_greater_equal
1242 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1243 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1244 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1245 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1246 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65535
1247 ; CHECK-NEXT: --> (65535 + (zext i16 %m to i32))<nuw><nsw> U: [65535,131071) S: [65535,131071)
1248 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1249 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: (zext i16 %n to i32) LoopDispositions: { %loop: Computable }
1250 ; CHECK-NEXT: %i.next = add i32 %i, 1
1251 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,65537) S: [1,65537) Exits: (1 + (zext i16 %n to i32))<nuw><nsw> LoopDispositions: { %loop: Computable }
1252 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1253 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1254 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_known_greater_equal
1255 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i16 %n to i32)
1256 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 65535
1257 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32)
1258 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i16 %n to i32)
1259 ; CHECK-NEXT: Predicates:
1260 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1263 %n.ext = zext i16 %n to i32
1264 %m.ext = zext i16 %m to i32
1265 %m.add = add i32 %m.ext, 65535
1268 %i = phi i32 [0, %entry], [%i.next, %loop]
1269 %i.next = add i32 %i, 1
1270 %cond_p0 = icmp ult i32 %i, %m.add
1271 %cond_p1 = icmp ult i32 %i, %n.ext
1272 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1273 br i1 %cond, label %loop, label %exit
1278 define i32 @logical_and_not_known_greater_equal(i16 %n, i16 %m) {
1279 ; CHECK-LABEL: 'logical_and_not_known_greater_equal'
1280 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_known_greater_equal
1281 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1282 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1283 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1284 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1285 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65534
1286 ; CHECK-NEXT: --> (65534 + (zext i16 %m to i32))<nuw><nsw> U: [65534,131070) S: [65534,131070)
1287 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1288 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: ((zext i16 %n to i32) umin (65534 + (zext i16 %m to i32))<nuw><nsw>) LoopDispositions: { %loop: Computable }
1289 ; CHECK-NEXT: %i.next = add i32 %i, 1
1290 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,65537) S: [1,65537) Exits: (1 + ((zext i16 %n to i32) umin (65534 + (zext i16 %m to i32))<nuw><nsw>))<nuw><nsw> LoopDispositions: { %loop: Computable }
1291 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1292 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1293 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_known_greater_equal
1294 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i16 %n to i32) umin (65534 + (zext i16 %m to i32))<nuw><nsw>)
1295 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 65535
1296 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((zext i16 %n to i32) umin (65534 + (zext i16 %m to i32))<nuw><nsw>)
1297 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i16 %n to i32) umin (65534 + (zext i16 %m to i32))<nuw><nsw>)
1298 ; CHECK-NEXT: Predicates:
1299 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1302 %n.ext = zext i16 %n to i32
1303 %m.ext = zext i16 %m to i32
1304 %m.add = add i32 %m.ext, 65534
1307 %i = phi i32 [0, %entry], [%i.next, %loop]
1308 %i.next = add i32 %i, 1
1309 %cond_p0 = icmp ult i32 %i, %m.add
1310 %cond_p1 = icmp ult i32 %i, %n.ext
1311 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1312 br i1 %cond, label %loop, label %exit
1317 define i32 @logical_and_zero_arg1(i32 %n) {
1318 ; CHECK-LABEL: 'logical_and_zero_arg1'
1319 ; CHECK-NEXT: Classifying expressions for: @logical_and_zero_arg1
1320 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1321 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %loop: Computable }
1322 ; CHECK-NEXT: %i.next = add i32 %i, 1
1323 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %loop: Computable }
1324 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1325 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: false LoopDispositions: { %loop: Variant }
1326 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_zero_arg1
1327 ; CHECK-NEXT: Loop %loop: backedge-taken count is 0
1328 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 0
1329 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 0
1330 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 0
1331 ; CHECK-NEXT: Predicates:
1332 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1337 %i = phi i32 [0, %entry], [%i.next, %loop]
1338 %i.next = add i32 %i, 1
1339 %cond_p0 = icmp ult i32 %i, 0
1340 %cond_p1 = icmp ult i32 %i, %n
1341 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1342 br i1 %cond, label %loop, label %exit
1347 define i32 @logical_and_zero_arg2(i32 %n) {
1348 ; CHECK-LABEL: 'logical_and_zero_arg2'
1349 ; CHECK-NEXT: Classifying expressions for: @logical_and_zero_arg2
1350 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1351 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %loop: Computable }
1352 ; CHECK-NEXT: %i.next = add i32 %i, 1
1353 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %loop: Computable }
1354 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1355 ; CHECK-NEXT: --> (%cond_p1 umin %cond_p0) U: full-set S: full-set Exits: false LoopDispositions: { %loop: Variant }
1356 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_zero_arg2
1357 ; CHECK-NEXT: Loop %loop: backedge-taken count is 0
1358 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is 0
1359 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is 0
1360 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 0
1361 ; CHECK-NEXT: Predicates:
1362 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1367 %i = phi i32 [0, %entry], [%i.next, %loop]
1368 %i.next = add i32 %i, 1
1369 %cond_p0 = icmp ult i32 %i, %n
1370 %cond_p1 = icmp ult i32 %i, 0
1371 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1372 br i1 %cond, label %loop, label %exit
1378 declare i32 @llvm.umin.i32(i32, i32)