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 i32 -1
16 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m)
17 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
22 %i = phi i32 [0, %entry], [%i.next, %loop]
23 %i.next = add i32 %i, 1
24 %cond_p0 = icmp ult i32 %i, %n
25 %cond_p1 = icmp ult i32 %i, %m
26 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
27 br i1 %cond, label %loop, label %exit
32 define i32 @logical_or_2ops(i32 %n, i32 %m) {
33 ; CHECK-LABEL: 'logical_or_2ops'
34 ; CHECK-NEXT: Classifying expressions for: @logical_or_2ops
35 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
36 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m) LoopDispositions: { %loop: Computable }
37 ; CHECK-NEXT: %i.next = add i32 %i, 1
38 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m)) LoopDispositions: { %loop: Computable }
39 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 true, i1 %cond_p1
40 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
41 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_2ops
42 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m)
43 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
44 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m)
45 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
50 %i = phi i32 [0, %entry], [%i.next, %loop]
51 %i.next = add i32 %i, 1
52 %cond_p0 = icmp uge i32 %i, %n
53 %cond_p1 = icmp uge i32 %i, %m
54 %cond = select i1 %cond_p0, i1 true, i1 %cond_p1
55 br i1 %cond, label %exit, label %loop
60 define i32 @logical_and_3ops(i32 %n, i32 %m, i32 %k) {
61 ; CHECK-LABEL: 'logical_and_3ops'
62 ; CHECK-NEXT: Classifying expressions for: @logical_and_3ops
63 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
64 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m umin_seq %k) LoopDispositions: { %loop: Computable }
65 ; CHECK-NEXT: %i.next = add i32 %i, 1
66 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m umin_seq %k)) LoopDispositions: { %loop: Computable }
67 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 %cond_p1, i1 false
68 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
69 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 %cond_p2, i1 false
70 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1 umin_seq %cond_p2) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
71 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_3ops
72 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m umin_seq %k)
73 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
74 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m umin_seq %k)
75 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
80 %i = phi i32 [0, %entry], [%i.next, %loop]
81 %i.next = add i32 %i, 1
82 %cond_p0 = icmp ult i32 %i, %n
83 %cond_p1 = icmp ult i32 %i, %m
84 %cond_p2 = icmp ult i32 %i, %k
85 %cond_p3 = select i1 %cond_p0, i1 %cond_p1, i1 false
86 %cond = select i1 %cond_p3, i1 %cond_p2, i1 false
87 br i1 %cond, label %loop, label %exit
92 define i32 @logical_or_3ops(i32 %n, i32 %m, i32 %k) {
93 ; CHECK-LABEL: 'logical_or_3ops'
94 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops
95 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
96 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m umin_seq %k) LoopDispositions: { %loop: Computable }
97 ; CHECK-NEXT: %i.next = add i32 %i, 1
98 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m umin_seq %k)) LoopDispositions: { %loop: Computable }
99 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
100 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
101 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
102 ; 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 }
103 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops
104 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m umin_seq %k)
105 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
106 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m umin_seq %k)
107 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
112 %i = phi i32 [0, %entry], [%i.next, %loop]
113 %i.next = add i32 %i, 1
114 %cond_p0 = icmp uge i32 %i, %n
115 %cond_p1 = icmp uge i32 %i, %m
116 %cond_p2 = icmp uge i32 %i, %k
117 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
118 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
119 br i1 %cond, label %exit, label %loop
124 define i32 @logical_or_3ops_duplicate(i32 %n, i32 %m, i32 %k) {
125 ; CHECK-LABEL: 'logical_or_3ops_duplicate'
126 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_duplicate
127 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
128 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m umin_seq %k) LoopDispositions: { %loop: Computable }
129 ; CHECK-NEXT: %i.next = add i32 %i, 1
130 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m umin_seq %k)) LoopDispositions: { %loop: Computable }
131 ; CHECK-NEXT: %cond_p4 = select i1 %cond_p0, i1 true, i1 %cond_p1
132 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
133 ; CHECK-NEXT: %cond_p5 = select i1 %cond_p4, i1 true, i1 %cond_p2
134 ; 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 }
135 ; CHECK-NEXT: %cond = select i1 %cond_p5, i1 true, i1 %cond_p3
136 ; 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 }
137 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_duplicate
138 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m umin_seq %k)
139 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
140 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m umin_seq %k)
141 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
146 %i = phi i32 [0, %entry], [%i.next, %loop]
147 %i.next = add i32 %i, 1
148 %cond_p0 = icmp uge i32 %i, %n
149 %cond_p1 = icmp uge i32 %i, %m
150 %cond_p2 = icmp uge i32 %i, %n
151 %cond_p3 = icmp uge i32 %i, %k
152 %cond_p4 = select i1 %cond_p0, i1 true, i1 %cond_p1
153 %cond_p5 = select i1 %cond_p4, i1 true, i1 %cond_p2
154 %cond = select i1 %cond_p5, i1 true, i1 %cond_p3
155 br i1 %cond, label %exit, label %loop
160 define i32 @logical_or_3ops_redundant_uminseq_operand(i32 %n, i32 %m, i32 %k) {
161 ; CHECK-LABEL: 'logical_or_3ops_redundant_uminseq_operand'
162 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_redundant_uminseq_operand
163 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
164 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n umin %m) umin_seq %k) LoopDispositions: { %loop: Computable }
165 ; CHECK-NEXT: %i.next = add i32 %i, 1
166 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n umin %m) umin_seq %k)) LoopDispositions: { %loop: Computable }
167 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
168 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
169 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
170 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
171 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
172 ; CHECK-NEXT: --> (true + (((true + %cond_p0) umin (true + %cond_p1)) umin_seq (true + %cond_p2))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
173 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_redundant_uminseq_operand
174 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n umin %m) umin_seq %k)
175 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
176 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n umin %m) umin_seq %k)
177 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
182 %i = phi i32 [0, %entry], [%i.next, %loop]
183 %i.next = add i32 %i, 1
184 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
185 %cond_p0 = icmp uge i32 %i, %umin
186 %cond_p1 = icmp uge i32 %i, %n
187 %cond_p2 = icmp uge i32 %i, %k
188 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
189 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
190 br i1 %cond, label %exit, label %loop
195 define i32 @logical_or_3ops_redundant_umin_operand(i32 %n, i32 %m, i32 %k) {
196 ; CHECK-LABEL: 'logical_or_3ops_redundant_umin_operand'
197 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_redundant_umin_operand
198 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
199 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %k umin_seq %m) LoopDispositions: { %loop: Computable }
200 ; CHECK-NEXT: %i.next = add i32 %i, 1
201 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %k umin_seq %m)) LoopDispositions: { %loop: Computable }
202 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
203 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
204 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
205 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
206 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
207 ; 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 }
208 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_redundant_umin_operand
209 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %k umin_seq %m)
210 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
211 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %k umin_seq %m)
212 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
217 %i = phi i32 [0, %entry], [%i.next, %loop]
218 %i.next = add i32 %i, 1
219 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
220 %cond_p0 = icmp uge i32 %i, %n
221 %cond_p1 = icmp uge i32 %i, %k
222 %cond_p2 = icmp uge i32 %i, %umin
223 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
224 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
225 br i1 %cond, label %exit, label %loop
230 define i32 @logical_or_4ops_redundant_operand_across_umins(i32 %n, i32 %m, i32 %k, i32 %q) {
231 ; CHECK-LABEL: 'logical_or_4ops_redundant_operand_across_umins'
232 ; CHECK-NEXT: Classifying expressions for: @logical_or_4ops_redundant_operand_across_umins
233 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
234 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n umin %m) umin_seq %k umin_seq %q) LoopDispositions: { %loop: Computable }
235 ; CHECK-NEXT: %i.next = add i32 %i, 1
236 ; 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 }
237 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
238 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
239 ; CHECK-NEXT: %umin2 = call i32 @llvm.umin.i32(i32 %n, i32 %q)
240 ; CHECK-NEXT: --> (%n umin %q) U: full-set S: full-set Exits: (%n umin %q) LoopDispositions: { %loop: Invariant }
241 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
242 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
243 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
244 ; 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 }
245 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_4ops_redundant_operand_across_umins
246 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n umin %m) umin_seq %k umin_seq %q)
247 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
248 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n umin %m) umin_seq %k umin_seq %q)
249 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
254 %i = phi i32 [0, %entry], [%i.next, %loop]
255 %i.next = add i32 %i, 1
256 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
257 %umin2 = call i32 @llvm.umin.i32(i32 %n, i32 %q)
258 %cond_p0 = icmp uge i32 %i, %umin
259 %cond_p1 = icmp uge i32 %i, %k
260 %cond_p2 = icmp uge i32 %i, %umin2
261 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
262 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
263 br i1 %cond, label %exit, label %loop
268 define i32 @logical_or_3ops_operand_wise_redundant_umin(i32 %n, i32 %m, i32 %k) {
269 ; CHECK-LABEL: 'logical_or_3ops_operand_wise_redundant_umin'
270 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_operand_wise_redundant_umin
271 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
272 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n umin %m) umin_seq %k) LoopDispositions: { %loop: Computable }
273 ; CHECK-NEXT: %i.next = add i32 %i, 1
274 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n umin %m) umin_seq %k)) LoopDispositions: { %loop: Computable }
275 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
276 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
277 ; CHECK-NEXT: %umin2 = call i32 @llvm.umin.i32(i32 %n, i32 %k)
278 ; CHECK-NEXT: --> (%n umin %k) U: full-set S: full-set Exits: (%n umin %k) LoopDispositions: { %loop: Invariant }
279 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
280 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
281 ; CHECK-NEXT: %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
282 ; 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 }
283 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_operand_wise_redundant_umin
284 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n umin %m) umin_seq %k)
285 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
286 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n umin %m) umin_seq %k)
287 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
292 %i = phi i32 [0, %entry], [%i.next, %loop]
293 %i.next = add i32 %i, 1
294 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
295 %umin2 = call i32 @llvm.umin.i32(i32 %n, i32 %k)
296 %cond_p0 = icmp uge i32 %i, %umin
297 %cond_p1 = icmp uge i32 %i, %k
298 %cond_p2 = icmp uge i32 %i, %umin2
299 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
300 %cond = select i1 %cond_p3, i1 true, i1 %cond_p2
301 br i1 %cond, label %exit, label %loop
306 define i32 @logical_or_3ops_partially_redundant_umin(i32 %n, i32 %m, i32 %k) {
307 ; CHECK-LABEL: 'logical_or_3ops_partially_redundant_umin'
308 ; CHECK-NEXT: Classifying expressions for: @logical_or_3ops_partially_redundant_umin
309 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
310 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq (%m umin %k)) LoopDispositions: { %loop: Computable }
311 ; CHECK-NEXT: %i.next = add i32 %i, 1
312 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq (%m umin %k))) LoopDispositions: { %loop: Computable }
313 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
314 ; CHECK-NEXT: --> (%n umin %m) U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Invariant }
315 ; CHECK-NEXT: %umin2 = call i32 @llvm.umin.i32(i32 %umin, i32 %k)
316 ; CHECK-NEXT: --> (%n umin %m umin %k) U: full-set S: full-set Exits: (%n umin %m umin %k) LoopDispositions: { %loop: Invariant }
317 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 true, i1 %cond_p1
318 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
319 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_3ops_partially_redundant_umin
320 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq (%m umin %k))
321 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
322 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq (%m umin %k))
323 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
328 %i = phi i32 [0, %entry], [%i.next, %loop]
329 %i.next = add i32 %i, 1
330 %umin = call i32 @llvm.umin.i32(i32 %n, i32 %m)
331 %umin2 = call i32 @llvm.umin.i32(i32 %umin, i32 %k)
332 %cond_p0 = icmp uge i32 %i, %n
333 %cond_p1 = icmp uge i32 %i, %umin2
334 %cond = select i1 %cond_p0, i1 true, i1 %cond_p1
335 br i1 %cond, label %exit, label %loop
340 define i32 @logical_or_5ops_redundant_opearand_of_inner_uminseq(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) {
341 ; CHECK-LABEL: 'logical_or_5ops_redundant_opearand_of_inner_uminseq'
342 ; CHECK-NEXT: Classifying expressions for: @logical_or_5ops_redundant_opearand_of_inner_uminseq
343 ; CHECK-NEXT: %first.i = phi i32 [ 0, %entry ], [ %first.i.next, %first.loop ]
344 ; CHECK-NEXT: --> {0,+,1}<%first.loop> U: full-set S: full-set Exits: (%e umin_seq %d umin_seq %a) LoopDispositions: { %first.loop: Computable }
345 ; CHECK-NEXT: %first.i.next = add i32 %first.i, 1
346 ; 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 }
347 ; CHECK-NEXT: %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
348 ; CHECK-NEXT: --> (true + ((true + %cond_p0) umin_seq (true + %cond_p1))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %first.loop: Variant }
349 ; CHECK-NEXT: %cond_p4 = select i1 %cond_p3, i1 true, i1 %cond_p2
350 ; 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 }
351 ; CHECK-NEXT: %i = phi i32 [ 0, %first.loop.exit ], [ %i.next, %loop ]
352 ; 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 }
353 ; CHECK-NEXT: %i.next = add i32 %i, 1
354 ; 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 }
355 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %c, i32 %d)
356 ; CHECK-NEXT: --> (%c umin %d) U: full-set S: full-set Exits: (%c umin %d) LoopDispositions: { %loop: Invariant }
357 ; CHECK-NEXT: %umin2 = call i32 @llvm.umin.i32(i32 %umin, i32 %first.i)
358 ; 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 }
359 ; CHECK-NEXT: %cond_p8 = select i1 %cond_p5, i1 true, i1 %cond_p6
360 ; CHECK-NEXT: --> (true + ((true + %cond_p5) umin_seq (true + %cond_p6))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
361 ; CHECK-NEXT: %cond = select i1 %cond_p8, i1 true, i1 %cond_p7
362 ; 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 }
363 ; CHECK-NEXT: Determining loop execution counts for: @logical_or_5ops_redundant_opearand_of_inner_uminseq
364 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%a umin_seq %b umin_seq ((%e umin_seq %d) umin %c))
365 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
366 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%a umin_seq %b umin_seq ((%e umin_seq %d) umin %c))
367 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
368 ; CHECK-NEXT: Loop %first.loop: backedge-taken count is (%e umin_seq %d umin_seq %a)
369 ; CHECK-NEXT: Loop %first.loop: constant max backedge-taken count is i32 -1
370 ; CHECK-NEXT: Loop %first.loop: symbolic max backedge-taken count is (%e umin_seq %d umin_seq %a)
371 ; CHECK-NEXT: Loop %first.loop: Trip multiple is 1
376 %first.i = phi i32 [0, %entry], [%first.i.next, %first.loop]
377 %first.i.next = add i32 %first.i, 1
378 %cond_p0 = icmp uge i32 %first.i, %e
379 %cond_p1 = icmp uge i32 %first.i, %d
380 %cond_p2 = icmp uge i32 %first.i, %a
381 %cond_p3 = select i1 %cond_p0, i1 true, i1 %cond_p1
382 %cond_p4 = select i1 %cond_p3, i1 true, i1 %cond_p2
383 br i1 %cond_p4, label %first.loop.exit, label %first.loop
387 %i = phi i32 [0, %first.loop.exit], [%i.next, %loop]
388 %i.next = add i32 %i, 1
389 %umin = call i32 @llvm.umin.i32(i32 %c, i32 %d)
390 %umin2 = call i32 @llvm.umin.i32(i32 %umin, i32 %first.i)
391 %cond_p5 = icmp uge i32 %i, %a
392 %cond_p6 = icmp uge i32 %i, %b
393 %cond_p7 = icmp uge i32 %i, %umin2
394 %cond_p8 = select i1 %cond_p5, i1 true, i1 %cond_p6
395 %cond = select i1 %cond_p8, i1 true, i1 %cond_p7
396 br i1 %cond, label %exit, label %loop
401 define i32 @logical_and_2ops_and_constant(i32 %n, i32 %m, i32 %k) {
402 ; CHECK-LABEL: 'logical_and_2ops_and_constant'
403 ; CHECK-NEXT: Classifying expressions for: @logical_and_2ops_and_constant
404 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
405 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,43) S: [0,43) Exits: (42 umin %n) LoopDispositions: { %loop: Computable }
406 ; CHECK-NEXT: %i.next = add i32 %i, 1
407 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,44) S: [1,44) Exits: (1 + (42 umin %n))<nuw><nsw> LoopDispositions: { %loop: Computable }
408 ; CHECK-NEXT: %umin = call i32 @llvm.umin.i32(i32 %n, i32 42)
409 ; CHECK-NEXT: --> (42 umin %n) U: [0,43) S: [0,43) Exits: (42 umin %n) LoopDispositions: { %loop: Invariant }
410 ; CHECK-NEXT: %cond = select i1 %cond_p1, i1 true, i1 %cond_p0
411 ; CHECK-NEXT: --> (true + ((true + %cond_p1) umin (true + %cond_p0))) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
412 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_2ops_and_constant
413 ; CHECK-NEXT: Loop %loop: backedge-taken count is (42 umin %n)
414 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 42
415 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (42 umin %n)
416 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
421 %i = phi i32 [0, %entry], [%i.next, %loop]
422 %i.next = add i32 %i, 1
423 %umin = call i32 @llvm.umin.i32(i32 %n, i32 42)
424 %cond_p0 = icmp uge i32 %i, %umin
425 %cond_p1 = icmp uge i32 %i, %n
426 %cond = select i1 %cond_p1, i1 true, i1 %cond_p0
427 br i1 %cond, label %exit, label %loop
432 define i32 @computeSCEVAtScope(i32 %d.0) {
433 ; CHECK-LABEL: 'computeSCEVAtScope'
434 ; CHECK-NEXT: Classifying expressions for: @computeSCEVAtScope
435 ; CHECK-NEXT: %d.1 = phi i32 [ %inc, %for.body ], [ %d.0, %for.cond.preheader ]
436 ; CHECK-NEXT: --> {%d.0,+,1}<nsw><%for.cond> U: full-set S: full-set Exits: 0 LoopDispositions: { %for.cond: Computable, %while.cond: Variant }
437 ; CHECK-NEXT: %e.1 = phi i32 [ %inc3, %for.body ], [ %d.0, %for.cond.preheader ]
438 ; CHECK-NEXT: --> {%d.0,+,1}<nsw><%for.cond> U: full-set S: full-set Exits: 0 LoopDispositions: { %for.cond: Computable, %while.cond: Variant }
439 ; CHECK-NEXT: %0 = select i1 %tobool1, i1 %tobool2, i1 false
440 ; CHECK-NEXT: --> (%tobool1 umin_seq %tobool2) U: full-set S: full-set Exits: false LoopDispositions: { %for.cond: Variant, %while.cond: Variant }
441 ; CHECK-NEXT: %inc = add nsw i32 %d.1, 1
442 ; CHECK-NEXT: --> {(1 + %d.0),+,1}<nw><%for.cond> U: full-set S: full-set Exits: 1 LoopDispositions: { %for.cond: Computable, %while.cond: Variant }
443 ; CHECK-NEXT: %inc3 = add nsw i32 %e.1, 1
444 ; CHECK-NEXT: --> {(1 + %d.0),+,1}<nw><%for.cond> U: full-set S: full-set Exits: 1 LoopDispositions: { %for.cond: Computable, %while.cond: Variant }
445 ; CHECK-NEXT: %f.1 = phi i32 [ %inc8, %for.body5 ], [ 0, %for.cond4.preheader ]
446 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%for.cond4> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %for.cond4: Computable, %while.cond: Variant }
447 ; CHECK-NEXT: %inc8 = add i32 %f.1, 1
448 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%for.cond4> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %for.cond4: Computable, %while.cond: Variant }
449 ; CHECK-NEXT: Determining loop execution counts for: @computeSCEVAtScope
450 ; CHECK-NEXT: Loop %for.cond: backedge-taken count is (-1 * %d.0)
451 ; CHECK-NEXT: Loop %for.cond: constant max backedge-taken count is i32 -1
452 ; CHECK-NEXT: Loop %for.cond: symbolic max backedge-taken count is (-1 * %d.0)
453 ; CHECK-NEXT: Loop %for.cond: Trip multiple is 1
454 ; CHECK-NEXT: Loop %for.cond4: backedge-taken count is i32 0
455 ; CHECK-NEXT: Loop %for.cond4: constant max backedge-taken count is i32 0
456 ; CHECK-NEXT: Loop %for.cond4: symbolic max backedge-taken count is i32 0
457 ; CHECK-NEXT: Loop %for.cond4: Trip multiple is 1
458 ; CHECK-NEXT: Loop %while.cond: <multiple exits> Unpredictable backedge-taken count.
459 ; CHECK-NEXT: Loop %while.cond: Unpredictable constant max backedge-taken count.
460 ; CHECK-NEXT: Loop %while.cond: Unpredictable symbolic max backedge-taken count.
465 while.cond.loopexit: ; preds = %for.cond4
468 while.cond: ; preds = %while.cond.loopexit, %entry
469 br label %for.cond.preheader
471 for.cond.preheader: ; preds = %while.cond
474 for.cond: ; preds = %for.body, %for.cond.preheader
475 %d.1 = phi i32 [ %inc, %for.body ], [ %d.0, %for.cond.preheader ]
476 %e.1 = phi i32 [ %inc3, %for.body ], [ %d.0, %for.cond.preheader ]
477 %tobool1 = icmp ne i32 %e.1, 0
478 %tobool2 = icmp ne i32 %d.1, 0
479 %0 = select i1 %tobool1, i1 %tobool2, i1 false
480 br i1 %0, label %for.body, label %for.cond4.preheader
482 for.cond4.preheader: ; preds = %for.cond
485 for.body: ; preds = %for.cond
486 %inc = add nsw i32 %d.1, 1
487 %inc3 = add nsw i32 %e.1, 1
490 for.cond4: ; preds = %for.body5, %for.cond4.preheader
491 %f.1 = phi i32 [ %inc8, %for.body5 ], [ 0, %for.cond4.preheader ]
492 %exitcond.not = icmp eq i32 %f.1, %e.1
493 br i1 %exitcond.not, label %while.cond.loopexit, label %for.body5
495 for.body5: ; preds = %for.cond4
496 %inc8 = add i32 %f.1, 1
500 define i64 @uminseq_vs_ptrtoint_complexity(i64 %n, i64 %m, ptr %ptr) {
501 ; CHECK-LABEL: 'uminseq_vs_ptrtoint_complexity'
502 ; CHECK-NEXT: Classifying expressions for: @uminseq_vs_ptrtoint_complexity
503 ; CHECK-NEXT: %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
504 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m) LoopDispositions: { %loop: Computable }
505 ; CHECK-NEXT: %i.next = add i64 %i, 1
506 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m)) LoopDispositions: { %loop: Computable }
507 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
508 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
509 ; CHECK-NEXT: %ptr.int = ptrtoint ptr %ptr to i64
510 ; CHECK-NEXT: --> (ptrtoint ptr %ptr to i64) U: full-set S: full-set
511 ; CHECK-NEXT: %r = add i64 %i, %ptr.int
512 ; 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
513 ; CHECK-NEXT: Determining loop execution counts for: @uminseq_vs_ptrtoint_complexity
514 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m)
515 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i64 -1
516 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m)
517 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
522 %i = phi i64 [0, %entry], [%i.next, %loop]
523 %i.next = add i64 %i, 1
524 %cond_p0 = icmp ult i64 %i, %n
525 %cond_p1 = icmp ult i64 %i, %m
526 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
527 br i1 %cond, label %loop, label %exit
529 %ptr.int = ptrtoint ptr %ptr to i64
530 %r = add i64 %i, %ptr.int
534 define i32 @logical_and_implies_poison1(i32 %n) {
535 ; CHECK-LABEL: 'logical_and_implies_poison1'
536 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison1
537 ; CHECK-NEXT: %add = add i32 %n, 1
538 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
539 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
540 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((1 + %n) umin %n) LoopDispositions: { %loop: Computable }
541 ; CHECK-NEXT: %i.next = add i32 %i, 1
542 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((1 + %n) umin %n)) LoopDispositions: { %loop: Computable }
543 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
544 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
545 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison1
546 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((1 + %n) umin %n)
547 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
548 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((1 + %n) umin %n)
549 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
555 %i = phi i32 [0, %entry], [%i.next, %loop]
556 %i.next = add i32 %i, 1
557 %cond_p0 = icmp ult i32 %i, %n
558 %cond_p1 = icmp ult i32 %i, %add
559 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
560 br i1 %cond, label %loop, label %exit
565 define i32 @logical_and_implies_poison2(i32 %n) {
566 ; CHECK-LABEL: 'logical_and_implies_poison2'
567 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison2
568 ; CHECK-NEXT: %add = add i32 %n, 1
569 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
570 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
571 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((1 + %n) umin %n) LoopDispositions: { %loop: Computable }
572 ; CHECK-NEXT: %i.next = add i32 %i, 1
573 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((1 + %n) umin %n)) LoopDispositions: { %loop: Computable }
574 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
575 ; CHECK-NEXT: --> (%cond_p1 umin %cond_p0) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
576 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison2
577 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((1 + %n) umin %n)
578 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
579 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((1 + %n) umin %n)
580 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
586 %i = phi i32 [0, %entry], [%i.next, %loop]
587 %i.next = add i32 %i, 1
588 %cond_p0 = icmp ult i32 %i, %add
589 %cond_p1 = icmp ult i32 %i, %n
590 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
591 br i1 %cond, label %loop, label %exit
596 define i32 @logical_and_implies_poison3(i32 %n, i32 %m) {
597 ; CHECK-LABEL: 'logical_and_implies_poison3'
598 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison3
599 ; CHECK-NEXT: %add = add i32 %n, %m
600 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
601 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
602 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n + %m) umin %n) LoopDispositions: { %loop: Computable }
603 ; CHECK-NEXT: %i.next = add i32 %i, 1
604 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n + %m) umin %n)) LoopDispositions: { %loop: Computable }
605 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
606 ; CHECK-NEXT: --> (%cond_p1 umin %cond_p0) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
607 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison3
608 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n + %m) umin %n)
609 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
610 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin %n)
611 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
614 %add = add i32 %n, %m
617 %i = phi i32 [0, %entry], [%i.next, %loop]
618 %i.next = add i32 %i, 1
619 %cond_p0 = icmp ult i32 %i, %add
620 %cond_p1 = icmp ult i32 %i, %n
621 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
622 br i1 %cond, label %loop, label %exit
627 define i32 @logical_and_implies_poison_wrong_direction(i32 %n, i32 %m) {
628 ; CHECK-LABEL: 'logical_and_implies_poison_wrong_direction'
629 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_wrong_direction
630 ; CHECK-NEXT: %add = add i32 %n, %m
631 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
632 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
633 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq (%n + %m)) LoopDispositions: { %loop: Computable }
634 ; CHECK-NEXT: %i.next = add i32 %i, 1
635 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq (%n + %m))) LoopDispositions: { %loop: Computable }
636 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
637 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
638 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_wrong_direction
639 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq (%n + %m))
640 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
641 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq (%n + %m))
642 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
645 %add = add i32 %n, %m
648 %i = phi i32 [0, %entry], [%i.next, %loop]
649 %i.next = add i32 %i, 1
650 %cond_p0 = icmp ult i32 %i, %n
651 %cond_p1 = icmp ult i32 %i, %add
652 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
653 br i1 %cond, label %loop, label %exit
658 define i32 @logical_and_implies_poison_noundef(i32 %n, i32 noundef %m) {
659 ; CHECK-LABEL: 'logical_and_implies_poison_noundef'
660 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_noundef
661 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
662 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin %m) LoopDispositions: { %loop: Computable }
663 ; CHECK-NEXT: %i.next = add i32 %i, 1
664 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin %m)) LoopDispositions: { %loop: Computable }
665 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
666 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
667 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_noundef
668 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin %m)
669 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
670 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin %m)
671 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
676 %i = phi i32 [0, %entry], [%i.next, %loop]
677 %i.next = add i32 %i, 1
678 %cond_p0 = icmp ult i32 %i, %n
679 %cond_p1 = icmp ult i32 %i, %m
680 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
681 br i1 %cond, label %loop, label %exit
686 define i32 @logical_and_implies_poison_noundef_wrong_direction(i32 %n, i32 noundef %m) {
687 ; CHECK-LABEL: 'logical_and_implies_poison_noundef_wrong_direction'
688 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_noundef_wrong_direction
689 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
690 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%m umin_seq %n) LoopDispositions: { %loop: Computable }
691 ; CHECK-NEXT: %i.next = add i32 %i, 1
692 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%m umin_seq %n)) LoopDispositions: { %loop: Computable }
693 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
694 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
695 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_noundef_wrong_direction
696 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%m umin_seq %n)
697 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
698 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%m umin_seq %n)
699 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
704 %i = phi i32 [0, %entry], [%i.next, %loop]
705 %i.next = add i32 %i, 1
706 %cond_p0 = icmp ult i32 %i, %m
707 %cond_p1 = icmp ult i32 %i, %n
708 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
709 br i1 %cond, label %loop, label %exit
714 define i32 @logical_and_implies_poison_complex1(i32 %n, i32 %m) {
715 ; CHECK-LABEL: 'logical_and_implies_poison_complex1'
716 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_complex1
717 ; CHECK-NEXT: %add = add i32 %n, %m
718 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
719 ; CHECK-NEXT: %add1 = add i32 %add, 1
720 ; CHECK-NEXT: --> (1 + %n + %m) U: full-set S: full-set
721 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
722 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n + %m) umin (1 + %n + %m)) LoopDispositions: { %loop: Computable }
723 ; CHECK-NEXT: %i.next = add i32 %i, 1
724 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n + %m) umin (1 + %n + %m))) LoopDispositions: { %loop: Computable }
725 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
726 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
727 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_complex1
728 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n + %m) umin (1 + %n + %m))
729 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
730 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin (1 + %n + %m))
731 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
734 %add = add i32 %n, %m
735 %add1 = add i32 %add, 1
738 %i = phi i32 [0, %entry], [%i.next, %loop]
739 %i.next = add i32 %i, 1
740 %cond_p0 = icmp ult i32 %i, %add1
741 %cond_p1 = icmp ult i32 %i, %add
742 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
743 br i1 %cond, label %loop, label %exit
748 define i32 @logical_and_implies_poison_complex2(i32 %n, i32 %m, i32 %l) {
749 ; CHECK-LABEL: 'logical_and_implies_poison_complex2'
750 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_complex2
751 ; CHECK-NEXT: %add = add i32 %n, %m
752 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
753 ; CHECK-NEXT: %add1 = add i32 %add, %l
754 ; CHECK-NEXT: --> (%n + %m + %l) U: full-set S: full-set
755 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
756 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n + %m) umin (%n + %m + %l)) LoopDispositions: { %loop: Computable }
757 ; CHECK-NEXT: %i.next = add i32 %i, 1
758 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n + %m) umin (%n + %m + %l))) LoopDispositions: { %loop: Computable }
759 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
760 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
761 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_complex2
762 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n + %m) umin (%n + %m + %l))
763 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
764 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin (%n + %m + %l))
765 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
768 %add = add i32 %n, %m
769 %add1 = add i32 %add, %l
772 %i = phi i32 [0, %entry], [%i.next, %loop]
773 %i.next = add i32 %i, 1
774 %cond_p0 = icmp ult i32 %i, %add1
775 %cond_p1 = icmp ult i32 %i, %add
776 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
777 br i1 %cond, label %loop, label %exit
782 define i32 @logical_and_implies_poison_complex_wrong_direction(i32 %n, i32 %m, i32 %l) {
783 ; CHECK-LABEL: 'logical_and_implies_poison_complex_wrong_direction'
784 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_poison_complex_wrong_direction
785 ; CHECK-NEXT: %add = add i32 %n, %m
786 ; CHECK-NEXT: --> (%n + %m) U: full-set S: full-set
787 ; CHECK-NEXT: %add1 = add i32 %add, %l
788 ; CHECK-NEXT: --> (%n + %m + %l) U: full-set S: full-set
789 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
790 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((%n + %m) umin_seq (%n + %m + %l)) LoopDispositions: { %loop: Computable }
791 ; CHECK-NEXT: %i.next = add i32 %i, 1
792 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((%n + %m) umin_seq (%n + %m + %l))) LoopDispositions: { %loop: Computable }
793 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
794 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
795 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_poison_complex_wrong_direction
796 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((%n + %m) umin_seq (%n + %m + %l))
797 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
798 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((%n + %m) umin_seq (%n + %m + %l))
799 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
802 %add = add i32 %n, %m
803 %add1 = add i32 %add, %l
806 %i = phi i32 [0, %entry], [%i.next, %loop]
807 %i.next = add i32 %i, 1
808 %cond_p0 = icmp ult i32 %i, %add
809 %cond_p1 = icmp ult i32 %i, %add1
810 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
811 br i1 %cond, label %loop, label %exit
816 define i32 @logical_and_implies_multiple_ops(i32 %n, i32 %m) {
817 ; CHECK-LABEL: 'logical_and_implies_multiple_ops'
818 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_multiple_ops
819 ; CHECK-NEXT: %add = add i32 %n, 1
820 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
821 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
822 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (((1 + %n) umin %n) umin_seq %m) LoopDispositions: { %loop: Computable }
823 ; CHECK-NEXT: %i.next = add i32 %i, 1
824 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (((1 + %n) umin %n) umin_seq %m)) LoopDispositions: { %loop: Computable }
825 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
826 ; CHECK-NEXT: --> (%cond_p0 umin %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
827 ; CHECK-NEXT: %cond2 = select i1 %cond, i1 %cond_p2, i1 false
828 ; CHECK-NEXT: --> ((%cond_p0 umin %cond_p1) umin_seq %cond_p2) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
829 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_multiple_ops
830 ; CHECK-NEXT: Loop %loop: backedge-taken count is (((1 + %n) umin %n) umin_seq %m)
831 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
832 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (((1 + %n) umin %n) umin_seq %m)
833 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
839 %i = phi i32 [0, %entry], [%i.next, %loop]
840 %i.next = add i32 %i, 1
841 %cond_p0 = icmp ult i32 %i, %n
842 %cond_p1 = icmp ult i32 %i, %add
843 %cond_p2 = icmp ult i32 %i, %m
844 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
845 %cond2 = select i1 %cond, i1 %cond_p2, i1 false
846 br i1 %cond2, label %loop, label %exit
851 define i32 @logical_and_implies_multiple_ops2(i32 %n, i32 %m) {
852 ; CHECK-LABEL: 'logical_and_implies_multiple_ops2'
853 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_multiple_ops2
854 ; CHECK-NEXT: %add = add i32 %n, 1
855 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
856 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
857 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq ((1 + %n) umin %m)) LoopDispositions: { %loop: Computable }
858 ; CHECK-NEXT: %i.next = add i32 %i, 1
859 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq ((1 + %n) umin %m))) LoopDispositions: { %loop: Computable }
860 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
861 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
862 ; CHECK-NEXT: %cond2 = select i1 %cond, i1 %cond_p2, i1 false
863 ; CHECK-NEXT: --> (%cond_p0 umin_seq (%cond_p1 umin %cond_p2)) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
864 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_multiple_ops2
865 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq ((1 + %n) umin %m))
866 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
867 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq ((1 + %n) umin %m))
868 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
874 %i = phi i32 [0, %entry], [%i.next, %loop]
875 %i.next = add i32 %i, 1
876 %cond_p0 = icmp ult i32 %i, %n
877 %cond_p1 = icmp ult i32 %i, %m
878 %cond_p2 = icmp ult i32 %i, %add
879 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
880 %cond2 = select i1 %cond, i1 %cond_p2, i1 false
881 br i1 %cond2, label %loop, label %exit
886 define i32 @logical_and_implies_multiple_ops3(i32 %n, i32 %m) {
887 ; CHECK-LABEL: 'logical_and_implies_multiple_ops3'
888 ; CHECK-NEXT: Classifying expressions for: @logical_and_implies_multiple_ops3
889 ; CHECK-NEXT: %add = add i32 %n, 1
890 ; CHECK-NEXT: --> (1 + %n) U: full-set S: full-set
891 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
892 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%m umin_seq ((1 + %n) umin %n)) LoopDispositions: { %loop: Computable }
893 ; CHECK-NEXT: %i.next = add i32 %i, 1
894 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%m umin_seq ((1 + %n) umin %n))) LoopDispositions: { %loop: Computable }
895 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
896 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
897 ; CHECK-NEXT: %cond2 = select i1 %cond, i1 %cond_p2, i1 false
898 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1 umin_seq %cond_p2) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
899 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_implies_multiple_ops3
900 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%m umin_seq ((1 + %n) umin %n))
901 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
902 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%m umin_seq ((1 + %n) umin %n))
903 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
909 %i = phi i32 [0, %entry], [%i.next, %loop]
910 %i.next = add i32 %i, 1
911 %cond_p0 = icmp ult i32 %i, %m
912 %cond_p1 = icmp ult i32 %i, %n
913 %cond_p2 = icmp ult i32 %i, %add
914 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
915 %cond2 = select i1 %cond, i1 %cond_p2, i1 false
916 br i1 %cond2, label %loop, label %exit
921 define i32 @logical_and_not_zero(i16 %n, i32 %m) {
922 ; CHECK-LABEL: 'logical_and_not_zero'
923 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_zero
924 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
925 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
926 ; CHECK-NEXT: %n1 = add i32 %n.ext, 1
927 ; CHECK-NEXT: --> (1 + (zext i16 %n to i32))<nuw><nsw> U: [1,65537) S: [1,65537)
928 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
929 ; 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 }
930 ; CHECK-NEXT: %i.next = add i32 %i, 1
931 ; 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 }
932 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
933 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
934 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_zero
935 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((1 + (zext i16 %n to i32))<nuw><nsw> umin %m)
936 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 65536
937 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((1 + (zext i16 %n to i32))<nuw><nsw> umin %m)
938 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
941 %n.ext = zext i16 %n to i32
942 %n1 = add i32 %n.ext, 1
945 %i = phi i32 [0, %entry], [%i.next, %loop]
946 %i.next = add i32 %i, 1
947 %cond_p0 = icmp ult i32 %i, %n1
948 %cond_p1 = icmp ult i32 %i, %m
949 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
950 br i1 %cond, label %loop, label %exit
955 define i32 @logical_and_not_zero_wrong_order(i16 %n, i32 %m) {
956 ; CHECK-LABEL: 'logical_and_not_zero_wrong_order'
957 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_zero_wrong_order
958 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
959 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
960 ; CHECK-NEXT: %n1 = add i32 %n.ext, 1
961 ; CHECK-NEXT: --> (1 + (zext i16 %n to i32))<nuw><nsw> U: [1,65537) S: [1,65537)
962 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
963 ; 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 }
964 ; CHECK-NEXT: %i.next = add i32 %i, 1
965 ; 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 }
966 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
967 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
968 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_zero_wrong_order
969 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%m umin_seq (1 + (zext i16 %n to i32))<nuw><nsw>)
970 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 65536
971 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%m umin_seq (1 + (zext i16 %n to i32))<nuw><nsw>)
972 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
975 %n.ext = zext i16 %n to i32
976 %n1 = add i32 %n.ext, 1
979 %i = phi i32 [0, %entry], [%i.next, %loop]
980 %i.next = add i32 %i, 1
981 %cond_p0 = icmp ult i32 %i, %m
982 %cond_p1 = icmp ult i32 %i, %n1
983 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
984 br i1 %cond, label %loop, label %exit
989 define i32 @logical_and_not_zero_needs_context(i32 %n, i32 %m) {
990 ; CHECK-LABEL: 'logical_and_not_zero_needs_context'
991 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_zero_needs_context
992 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
993 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (%n umin_seq %m) LoopDispositions: { %loop: Computable }
994 ; CHECK-NEXT: %i.next = add i32 %i, 1
995 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (%n umin_seq %m)) LoopDispositions: { %loop: Computable }
996 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
997 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
998 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_zero_needs_context
999 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%n umin_seq %m)
1000 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
1001 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (%n umin_seq %m)
1002 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1005 %cmp = icmp ne i32 %n, 0
1006 br i1 %cmp, label %loop, label %guard.fail
1008 %i = phi i32 [0, %entry], [%i.next, %loop]
1009 %i.next = add i32 %i, 1
1010 %cond_p0 = icmp ult i32 %i, %n
1011 %cond_p1 = icmp ult i32 %i, %m
1012 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1013 br i1 %cond, label %loop, label %exit
1020 define i32 @logical_and_known_smaller(i16 %n, i16 %m) {
1021 ; CHECK-LABEL: 'logical_and_known_smaller'
1022 ; CHECK-NEXT: Classifying expressions for: @logical_and_known_smaller
1023 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1024 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1025 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1026 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1027 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65536
1028 ; CHECK-NEXT: --> (65536 + (zext i16 %m to i32))<nuw><nsw> U: [65536,131072) S: [65536,131072)
1029 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1030 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: (zext i16 %n to i32) LoopDispositions: { %loop: Computable }
1031 ; CHECK-NEXT: %i.next = add i32 %i, 1
1032 ; 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 }
1033 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1034 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1035 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_known_smaller
1036 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i16 %n to i32)
1037 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 65535
1038 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32)
1039 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1042 %n.ext = zext i16 %n to i32
1043 %m.ext = zext i16 %m to i32
1044 %m.add = add i32 %m.ext, 65536
1047 %i = phi i32 [0, %entry], [%i.next, %loop]
1048 %i.next = add i32 %i, 1
1049 %cond_p0 = icmp ult i32 %i, %n.ext
1050 %cond_p1 = icmp ult i32 %i, %m.add
1051 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1052 br i1 %cond, label %loop, label %exit
1057 define i32 @logical_and_known_smaller_equal(i16 %n, i16 %m) {
1058 ; CHECK-LABEL: 'logical_and_known_smaller_equal'
1059 ; CHECK-NEXT: Classifying expressions for: @logical_and_known_smaller_equal
1060 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1061 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1062 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1063 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1064 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65535
1065 ; CHECK-NEXT: --> (65535 + (zext i16 %m to i32))<nuw><nsw> U: [65535,131071) S: [65535,131071)
1066 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1067 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: (zext i16 %n to i32) LoopDispositions: { %loop: Computable }
1068 ; CHECK-NEXT: %i.next = add i32 %i, 1
1069 ; 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 }
1070 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1071 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1072 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_known_smaller_equal
1073 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i16 %n to i32)
1074 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 65535
1075 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32)
1076 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1079 %n.ext = zext i16 %n to i32
1080 %m.ext = zext i16 %m to i32
1081 %m.add = add i32 %m.ext, 65535
1084 %i = phi i32 [0, %entry], [%i.next, %loop]
1085 %i.next = add i32 %i, 1
1086 %cond_p0 = icmp ult i32 %i, %n.ext
1087 %cond_p1 = icmp ult i32 %i, %m.add
1088 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1089 br i1 %cond, label %loop, label %exit
1094 define i32 @logical_and_not_known_smaller_equal(i16 %n, i16 %m) {
1095 ; CHECK-LABEL: 'logical_and_not_known_smaller_equal'
1096 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_known_smaller_equal
1097 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1098 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1099 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1100 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1101 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65534
1102 ; CHECK-NEXT: --> (65534 + (zext i16 %m to i32))<nuw><nsw> U: [65534,131070) S: [65534,131070)
1103 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1104 ; 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 }
1105 ; CHECK-NEXT: %i.next = add i32 %i, 1
1106 ; 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 }
1107 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1108 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1109 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_known_smaller_equal
1110 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i16 %n to i32) umin_seq (65534 + (zext i16 %m to i32))<nuw><nsw>)
1111 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 65535
1112 ; 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>)
1113 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1116 %n.ext = zext i16 %n to i32
1117 %m.ext = zext i16 %m to i32
1118 %m.add = add i32 %m.ext, 65534
1121 %i = phi i32 [0, %entry], [%i.next, %loop]
1122 %i.next = add i32 %i, 1
1123 %cond_p0 = icmp ult i32 %i, %n.ext
1124 %cond_p1 = icmp ult i32 %i, %m.add
1125 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1126 br i1 %cond, label %loop, label %exit
1131 define i32 @logical_and_known_greater(i16 %n, i16 %m) {
1132 ; CHECK-LABEL: 'logical_and_known_greater'
1133 ; CHECK-NEXT: Classifying expressions for: @logical_and_known_greater
1134 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1135 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1136 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1137 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1138 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65536
1139 ; CHECK-NEXT: --> (65536 + (zext i16 %m to i32))<nuw><nsw> U: [65536,131072) S: [65536,131072)
1140 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1141 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: (zext i16 %n to i32) LoopDispositions: { %loop: Computable }
1142 ; CHECK-NEXT: %i.next = add i32 %i, 1
1143 ; 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 }
1144 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1145 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1146 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_known_greater
1147 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i16 %n to i32)
1148 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 65535
1149 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32)
1150 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1153 %n.ext = zext i16 %n to i32
1154 %m.ext = zext i16 %m to i32
1155 %m.add = add i32 %m.ext, 65536
1158 %i = phi i32 [0, %entry], [%i.next, %loop]
1159 %i.next = add i32 %i, 1
1160 %cond_p0 = icmp ult i32 %i, %m.add
1161 %cond_p1 = icmp ult i32 %i, %n.ext
1162 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1163 br i1 %cond, label %loop, label %exit
1168 define i32 @logical_and_known_greater_equal(i16 %n, i16 %m) {
1169 ; CHECK-LABEL: 'logical_and_known_greater_equal'
1170 ; CHECK-NEXT: Classifying expressions for: @logical_and_known_greater_equal
1171 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1172 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1173 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1174 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1175 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65535
1176 ; CHECK-NEXT: --> (65535 + (zext i16 %m to i32))<nuw><nsw> U: [65535,131071) S: [65535,131071)
1177 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1178 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,65536) S: [0,65536) Exits: (zext i16 %n to i32) LoopDispositions: { %loop: Computable }
1179 ; CHECK-NEXT: %i.next = add i32 %i, 1
1180 ; 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 }
1181 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1182 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1183 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_known_greater_equal
1184 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i16 %n to i32)
1185 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 65535
1186 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is (zext i16 %n to i32)
1187 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1190 %n.ext = zext i16 %n to i32
1191 %m.ext = zext i16 %m to i32
1192 %m.add = add i32 %m.ext, 65535
1195 %i = phi i32 [0, %entry], [%i.next, %loop]
1196 %i.next = add i32 %i, 1
1197 %cond_p0 = icmp ult i32 %i, %m.add
1198 %cond_p1 = icmp ult i32 %i, %n.ext
1199 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1200 br i1 %cond, label %loop, label %exit
1205 define i32 @logical_and_not_known_greater_equal(i16 %n, i16 %m) {
1206 ; CHECK-LABEL: 'logical_and_not_known_greater_equal'
1207 ; CHECK-NEXT: Classifying expressions for: @logical_and_not_known_greater_equal
1208 ; CHECK-NEXT: %n.ext = zext i16 %n to i32
1209 ; CHECK-NEXT: --> (zext i16 %n to i32) U: [0,65536) S: [0,65536)
1210 ; CHECK-NEXT: %m.ext = zext i16 %m to i32
1211 ; CHECK-NEXT: --> (zext i16 %m to i32) U: [0,65536) S: [0,65536)
1212 ; CHECK-NEXT: %m.add = add i32 %m.ext, 65534
1213 ; CHECK-NEXT: --> (65534 + (zext i16 %m to i32))<nuw><nsw> U: [65534,131070) S: [65534,131070)
1214 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1215 ; 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 }
1216 ; CHECK-NEXT: %i.next = add i32 %i, 1
1217 ; 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 }
1218 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1219 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
1220 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_not_known_greater_equal
1221 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i16 %n to i32) umin (65534 + (zext i16 %m to i32))<nuw><nsw>)
1222 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 65535
1223 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((zext i16 %n to i32) umin (65534 + (zext i16 %m to i32))<nuw><nsw>)
1224 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1227 %n.ext = zext i16 %n to i32
1228 %m.ext = zext i16 %m to i32
1229 %m.add = add i32 %m.ext, 65534
1232 %i = phi i32 [0, %entry], [%i.next, %loop]
1233 %i.next = add i32 %i, 1
1234 %cond_p0 = icmp ult i32 %i, %m.add
1235 %cond_p1 = icmp ult i32 %i, %n.ext
1236 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1237 br i1 %cond, label %loop, label %exit
1242 define i32 @logical_and_zero_arg1(i32 %n) {
1243 ; CHECK-LABEL: 'logical_and_zero_arg1'
1244 ; CHECK-NEXT: Classifying expressions for: @logical_and_zero_arg1
1245 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1246 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %loop: Computable }
1247 ; CHECK-NEXT: %i.next = add i32 %i, 1
1248 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %loop: Computable }
1249 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1250 ; CHECK-NEXT: --> (%cond_p0 umin_seq %cond_p1) U: full-set S: full-set Exits: false LoopDispositions: { %loop: Variant }
1251 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_zero_arg1
1252 ; CHECK-NEXT: Loop %loop: backedge-taken count is i32 0
1253 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 0
1254 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is i32 0
1255 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1260 %i = phi i32 [0, %entry], [%i.next, %loop]
1261 %i.next = add i32 %i, 1
1262 %cond_p0 = icmp ult i32 %i, 0
1263 %cond_p1 = icmp ult i32 %i, %n
1264 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1265 br i1 %cond, label %loop, label %exit
1270 define i32 @logical_and_zero_arg2(i32 %n) {
1271 ; CHECK-LABEL: 'logical_and_zero_arg2'
1272 ; CHECK-NEXT: Classifying expressions for: @logical_and_zero_arg2
1273 ; CHECK-NEXT: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
1274 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %loop: Computable }
1275 ; CHECK-NEXT: %i.next = add i32 %i, 1
1276 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %loop: Computable }
1277 ; CHECK-NEXT: %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1278 ; CHECK-NEXT: --> (%cond_p1 umin %cond_p0) U: full-set S: full-set Exits: false LoopDispositions: { %loop: Variant }
1279 ; CHECK-NEXT: Determining loop execution counts for: @logical_and_zero_arg2
1280 ; CHECK-NEXT: Loop %loop: backedge-taken count is i32 0
1281 ; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 0
1282 ; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is i32 0
1283 ; CHECK-NEXT: Loop %loop: Trip multiple is 1
1288 %i = phi i32 [0, %entry], [%i.next, %loop]
1289 %i.next = add i32 %i, 1
1290 %cond_p0 = icmp ult i32 %i, %n
1291 %cond_p1 = icmp ult i32 %i, 0
1292 %cond = select i1 %cond_p0, i1 %cond_p1, i1 false
1293 br i1 %cond, label %loop, label %exit
1299 declare i32 @llvm.umin.i32(i32, i32)