1 ; RUN: llc -mtriple=thumbv8.1m.main -mattr=+lob -disable-arm-loloops=false -start-after=hardware-loops -stop-before=arm-low-overhead-loops %s -o - | FileCheck %s --check-prefix=CHECK-MID
3 ; Test that the branch targets are correct after isel, even though the loop
4 ; will sometimes be reverted anyway.
6 ; CHECK-MID: name: check_loop_dec_brcond_combine
7 ; CHECK-MID: bb.0.entry:
8 ; CHECK-MID: renamable $lr = t2DoLoopStart killed renamable $r3
9 ; CHECK-MID: bb.1.for.header:
10 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
11 ; CHECK-MID: bb.2.for.cond.cleanup:
12 define void @check_loop_dec_brcond_combine(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
14 %start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
15 br label %for.body.preheader
18 %scevgep = getelementptr i32, ptr %a, i32 -1
19 %scevgep4 = getelementptr i32, ptr %c, i32 -1
20 %scevgep8 = getelementptr i32, ptr %b, i32 -1
24 %scevgep11 = getelementptr i32, ptr %lsr.iv9, i32 1
25 %ld1 = load i32, ptr %scevgep11, align 4
26 %scevgep7 = getelementptr i32, ptr %lsr.iv5, i32 1
27 %ld2 = load i32, ptr %scevgep7, align 4
28 %mul = mul nsw i32 %ld2, %ld1
29 %scevgep3 = getelementptr i32, ptr %lsr.iv1, i32 1
30 store i32 %mul, ptr %scevgep3, align 4
31 %scevgep2 = getelementptr i32, ptr %lsr.iv1, i32 1
32 %scevgep6 = getelementptr i32, ptr %lsr.iv5, i32 1
33 %scevgep10 = getelementptr i32, ptr %lsr.iv9, i32 1
34 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
35 %cmp = icmp ne i32 %count.next, 0
36 br i1 %cmp, label %for.header, label %for.cond.cleanup
39 %lsr.iv9 = phi ptr [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
40 %lsr.iv5 = phi ptr [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
41 %lsr.iv1 = phi ptr [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
42 %count = phi i32 [ %start, %for.body.preheader ], [ %count.next, %for.body ]
49 ; CHECK-MID: name: check_loop_dec_ugt_brcond_combine
50 ; CHECK-MID: bb.0.entry:
51 ; CHECK-MID: renamable $lr = t2DoLoopStart killed renamable $r3
52 ; CHECK-MID: bb.1.for.header:
53 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
54 ; CHECK-MID: tB %bb.2, 14
55 ; CHECK-MID: bb.2.for.cond.cleanup:
56 define void @check_loop_dec_ugt_brcond_combine(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
58 %start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
59 br label %for.body.preheader
62 %scevgep = getelementptr i32, ptr %a, i32 -1
63 %scevgep4 = getelementptr i32, ptr %c, i32 -1
64 %scevgep8 = getelementptr i32, ptr %b, i32 -1
68 %scevgep11 = getelementptr i32, ptr %lsr.iv9, i32 1
69 %ld1 = load i32, ptr %scevgep11, align 4
70 %scevgep7 = getelementptr i32, ptr %lsr.iv5, i32 1
71 %ld2 = load i32, ptr %scevgep7, align 4
72 %mul = mul nsw i32 %ld2, %ld1
73 %scevgep3 = getelementptr i32, ptr %lsr.iv1, i32 1
74 store i32 %mul, ptr %scevgep3, align 4
75 %scevgep2 = getelementptr i32, ptr %lsr.iv1, i32 1
76 %scevgep6 = getelementptr i32, ptr %lsr.iv5, i32 1
77 %scevgep10 = getelementptr i32, ptr %lsr.iv9, i32 1
78 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
79 %cmp = icmp ugt i32 %count.next, 0
80 br i1 %cmp, label %for.header, label %for.cond.cleanup
83 %lsr.iv9 = phi ptr [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
84 %lsr.iv5 = phi ptr [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
85 %lsr.iv1 = phi ptr [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
86 %count = phi i32 [ %start, %for.body.preheader ], [ %count.next, %for.body ]
93 ; CHECK-MID: name: check_loop_dec_ult_brcond_combine
94 ; CHECK-MID: bb.0.entry:
95 ; CHECK-MID: renamable $lr = t2DoLoopStart killed renamable $r3
96 ; CHECK-MID: bb.1.for.header:
97 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
98 ; CHECK-MID: tB %bb.2, 14
99 ; CHECK-MID: bb.2.for.cond.cleanup:
100 define void @check_loop_dec_ult_brcond_combine(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
102 %start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
103 br label %for.body.preheader
106 %scevgep = getelementptr i32, ptr %a, i32 -1
107 %scevgep4 = getelementptr i32, ptr %c, i32 -1
108 %scevgep8 = getelementptr i32, ptr %b, i32 -1
112 %scevgep11 = getelementptr i32, ptr %lsr.iv9, i32 1
113 %ld1 = load i32, ptr %scevgep11, align 4
114 %scevgep7 = getelementptr i32, ptr %lsr.iv5, i32 1
115 %ld2 = load i32, ptr %scevgep7, align 4
116 %mul = mul nsw i32 %ld2, %ld1
117 %scevgep3 = getelementptr i32, ptr %lsr.iv1, i32 1
118 store i32 %mul, ptr %scevgep3, align 4
119 %scevgep2 = getelementptr i32, ptr %lsr.iv1, i32 1
120 %scevgep6 = getelementptr i32, ptr %lsr.iv5, i32 1
121 %scevgep10 = getelementptr i32, ptr %lsr.iv9, i32 1
122 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
123 %cmp = icmp ult i32 %count.next, 1
124 br i1 %cmp, label %for.cond.cleanup, label %for.header
127 %lsr.iv9 = phi ptr [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
128 %lsr.iv5 = phi ptr [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
129 %lsr.iv1 = phi ptr [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
130 %count = phi i32 [ %start, %for.body.preheader ], [ %count.next, %for.body ]
137 ; CHECK-MID: name: check_loop_dec_ult_xor_brcond_combine
138 ; CHECK-MID: bb.0.entry:
139 ; CHECK-MID: renamable $lr = t2DoLoopStart killed renamable $r3
140 ; CHECK-MID: bb.1.for.header:
141 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
142 ; CHECK-MID: tB %bb.2, 14
143 ; CHECK-MID: bb.2.for.cond.cleanup:
144 define void @check_loop_dec_ult_xor_brcond_combine(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
146 %start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
147 br label %for.body.preheader
150 %scevgep = getelementptr i32, ptr %a, i32 -1
151 %scevgep4 = getelementptr i32, ptr %c, i32 -1
152 %scevgep8 = getelementptr i32, ptr %b, i32 -1
156 %scevgep11 = getelementptr i32, ptr %lsr.iv9, i32 1
157 %ld1 = load i32, ptr %scevgep11, align 4
158 %scevgep7 = getelementptr i32, ptr %lsr.iv5, i32 1
159 %ld2 = load i32, ptr %scevgep7, align 4
160 %mul = mul nsw i32 %ld2, %ld1
161 %scevgep3 = getelementptr i32, ptr %lsr.iv1, i32 1
162 store i32 %mul, ptr %scevgep3, align 4
163 %scevgep2 = getelementptr i32, ptr %lsr.iv1, i32 1
164 %scevgep6 = getelementptr i32, ptr %lsr.iv5, i32 1
165 %scevgep10 = getelementptr i32, ptr %lsr.iv9, i32 1
166 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
167 %cmp = icmp ult i32 %count.next, 1
168 %negate = xor i1 %cmp, 1
169 br i1 %negate, label %for.header, label %for.cond.cleanup
172 %lsr.iv9 = phi ptr [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
173 %lsr.iv5 = phi ptr [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
174 %lsr.iv1 = phi ptr [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
175 %count = phi i32 [ %start, %for.body.preheader ], [ %count.next, %for.body ]
182 ; CHECK-MID: name: check_loop_dec_sgt_brcond_combine
183 ; CHECK-MID: bb.0.entry:
184 ; CHECK-MID: renamable $lr = t2DoLoopStart killed renamable $r3
185 ; CHECK-MID: bb.1.for.header:
186 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
187 ; CHECK-MID: tB %bb.2, 14
188 ; CHECK-MID: bb.2.for.cond.cleanup:
189 define void @check_loop_dec_sgt_brcond_combine(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
191 %start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
192 br label %for.body.preheader
195 %scevgep = getelementptr i32, ptr %a, i32 -1
196 %scevgep4 = getelementptr i32, ptr %c, i32 -1
197 %scevgep8 = getelementptr i32, ptr %b, i32 -1
201 %scevgep11 = getelementptr i32, ptr %lsr.iv9, i32 1
202 %ld1 = load i32, ptr %scevgep11, align 4
203 %scevgep7 = getelementptr i32, ptr %lsr.iv5, i32 1
204 %ld2 = load i32, ptr %scevgep7, align 4
205 %mul = mul nsw i32 %ld2, %ld1
206 %scevgep3 = getelementptr i32, ptr %lsr.iv1, i32 1
207 store i32 %mul, ptr %scevgep3, align 4
208 %scevgep2 = getelementptr i32, ptr %lsr.iv1, i32 1
209 %scevgep6 = getelementptr i32, ptr %lsr.iv5, i32 1
210 %scevgep10 = getelementptr i32, ptr %lsr.iv9, i32 1
211 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
212 %cmp = icmp sgt i32 %count.next, 0
213 br i1 %cmp, label %for.header, label %for.cond.cleanup
216 %lsr.iv9 = phi ptr [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
217 %lsr.iv5 = phi ptr [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
218 %lsr.iv1 = phi ptr [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
219 %count = phi i32 [ %start, %for.body.preheader ], [ %count.next, %for.body ]
226 ; CHECK-MID: name: check_loop_dec_sge_brcond_combine
227 ; CHECK-MID: bb.0.entry:
228 ; CHECK-MID: renamable $lr = t2DoLoopStart killed renamable $r3
229 ; CHECK-MID: bb.1.for.header:
230 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
231 ; CHECK-MID: tB %bb.2, 14
232 ; CHECK-MID: bb.2.for.cond.cleanup:
233 define void @check_loop_dec_sge_brcond_combine(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
235 %start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
236 br label %for.body.preheader
239 %scevgep = getelementptr i32, ptr %a, i32 -1
240 %scevgep4 = getelementptr i32, ptr %c, i32 -1
241 %scevgep8 = getelementptr i32, ptr %b, i32 -1
245 %scevgep11 = getelementptr i32, ptr %lsr.iv9, i32 1
246 %ld1 = load i32, ptr %scevgep11, align 4
247 %scevgep7 = getelementptr i32, ptr %lsr.iv5, i32 1
248 %ld2 = load i32, ptr %scevgep7, align 4
249 %mul = mul nsw i32 %ld2, %ld1
250 %scevgep3 = getelementptr i32, ptr %lsr.iv1, i32 1
251 store i32 %mul, ptr %scevgep3, align 4
252 %scevgep2 = getelementptr i32, ptr %lsr.iv1, i32 1
253 %scevgep6 = getelementptr i32, ptr %lsr.iv5, i32 1
254 %scevgep10 = getelementptr i32, ptr %lsr.iv9, i32 1
255 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
256 %cmp = icmp sge i32 %count.next, 1
257 br i1 %cmp, label %for.header, label %for.cond.cleanup
260 %lsr.iv9 = phi ptr [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
261 %lsr.iv5 = phi ptr [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
262 %lsr.iv1 = phi ptr [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
263 %count = phi i32 [ %start, %for.body.preheader ], [ %count.next, %for.body ]
270 ; CHECK-MID: name: check_loop_dec_sge_xor_brcond_combine
271 ; CHECK-MID: bb.0.entry:
272 ; CHECK-MID: renamable $lr = t2DoLoopStart killed renamable $r3
273 ; CHECK-MID: bb.1.for.header:
274 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
275 ; CHECK-MID: tB %bb.2, 14
276 ; CHECK-MID: bb.2.for.cond.cleanup:
277 define void @check_loop_dec_sge_xor_brcond_combine(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
279 %start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
280 br label %for.body.preheader
283 %scevgep = getelementptr i32, ptr %a, i32 -1
284 %scevgep4 = getelementptr i32, ptr %c, i32 -1
285 %scevgep8 = getelementptr i32, ptr %b, i32 -1
289 %scevgep11 = getelementptr i32, ptr %lsr.iv9, i32 1
290 %ld1 = load i32, ptr %scevgep11, align 4
291 %scevgep7 = getelementptr i32, ptr %lsr.iv5, i32 1
292 %ld2 = load i32, ptr %scevgep7, align 4
293 %mul = mul nsw i32 %ld2, %ld1
294 %scevgep3 = getelementptr i32, ptr %lsr.iv1, i32 1
295 store i32 %mul, ptr %scevgep3, align 4
296 %scevgep2 = getelementptr i32, ptr %lsr.iv1, i32 1
297 %scevgep6 = getelementptr i32, ptr %lsr.iv5, i32 1
298 %scevgep10 = getelementptr i32, ptr %lsr.iv9, i32 1
299 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
300 %cmp = icmp sge i32 %count.next, 1
301 %negated = xor i1 %cmp, 1
302 br i1 %negated, label %for.cond.cleanup, label %for.header
305 %lsr.iv9 = phi ptr [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
306 %lsr.iv5 = phi ptr [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
307 %lsr.iv1 = phi ptr [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
308 %count = phi i32 [ %start, %for.body.preheader ], [ %count.next, %for.body ]
315 ; CHECK-MID: name: check_loop_dec_uge_brcond_combine
316 ; CHECK-MID: bb.0.entry:
317 ; CHECK-MID: renamable $lr = t2DoLoopStart killed renamable $r3
318 ; CHECK-MID: bb.1.for.header:
319 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
320 ; CHECK-MID: tB %bb.2, 14
321 ; CHECK-MID: bb.2.for.cond.cleanup:
322 define void @check_loop_dec_uge_brcond_combine(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
324 %start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
325 br label %for.body.preheader
328 %scevgep = getelementptr i32, ptr %a, i32 -1
329 %scevgep4 = getelementptr i32, ptr %c, i32 -1
330 %scevgep8 = getelementptr i32, ptr %b, i32 -1
334 %scevgep11 = getelementptr i32, ptr %lsr.iv9, i32 1
335 %ld1 = load i32, ptr %scevgep11, align 4
336 %scevgep7 = getelementptr i32, ptr %lsr.iv5, i32 1
337 %ld2 = load i32, ptr %scevgep7, align 4
338 %mul = mul nsw i32 %ld2, %ld1
339 %scevgep3 = getelementptr i32, ptr %lsr.iv1, i32 1
340 store i32 %mul, ptr %scevgep3, align 4
341 %scevgep2 = getelementptr i32, ptr %lsr.iv1, i32 1
342 %scevgep6 = getelementptr i32, ptr %lsr.iv5, i32 1
343 %scevgep10 = getelementptr i32, ptr %lsr.iv9, i32 1
344 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
345 %cmp = icmp uge i32 %count.next, 1
346 br i1 %cmp, label %for.header, label %for.cond.cleanup
349 %lsr.iv9 = phi ptr [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
350 %lsr.iv5 = phi ptr [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
351 %lsr.iv1 = phi ptr [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
352 %count = phi i32 [ %start, %for.body.preheader ], [ %count.next, %for.body ]
359 ; CHECK-MID: name: check_loop_dec_uge_xor_brcond_combine
360 ; CHECK-MID: bb.0.entry:
361 ; CHECK-MID: renamable $lr = t2DoLoopStart killed renamable $r3
362 ; CHECK-MID: bb.1.for.header:
363 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
364 ; CHECK-MID: tB %bb.2, 14
365 ; CHECK-MID: bb.2.for.cond.cleanup:
366 define void @check_loop_dec_uge_xor_brcond_combine(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
368 %start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
369 br label %for.body.preheader
372 %scevgep = getelementptr i32, ptr %a, i32 -1
373 %scevgep4 = getelementptr i32, ptr %c, i32 -1
374 %scevgep8 = getelementptr i32, ptr %b, i32 -1
378 %scevgep11 = getelementptr i32, ptr %lsr.iv9, i32 1
379 %ld1 = load i32, ptr %scevgep11, align 4
380 %scevgep7 = getelementptr i32, ptr %lsr.iv5, i32 1
381 %ld2 = load i32, ptr %scevgep7, align 4
382 %mul = mul nsw i32 %ld2, %ld1
383 %scevgep3 = getelementptr i32, ptr %lsr.iv1, i32 1
384 store i32 %mul, ptr %scevgep3, align 4
385 %scevgep2 = getelementptr i32, ptr %lsr.iv1, i32 1
386 %scevgep6 = getelementptr i32, ptr %lsr.iv5, i32 1
387 %scevgep10 = getelementptr i32, ptr %lsr.iv9, i32 1
388 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
389 %cmp = icmp uge i32 %count.next, 1
390 %negated = xor i1 %cmp, 1
391 br i1 %negated, label %for.cond.cleanup, label %for.header
394 %lsr.iv9 = phi ptr [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
395 %lsr.iv5 = phi ptr [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
396 %lsr.iv1 = phi ptr [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
397 %count = phi i32 [ %start, %for.body.preheader ], [ %count.next, %for.body ]
404 ; CHECK-MID: check_negated_xor_wls
405 ; CHECK-MID: $lr = t2WhileLoopStartLR killed renamable $r2
406 ; CHECK-MID: tB %bb.1
407 ; CHECK-MID: bb.1.while.body:
408 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
409 ; CHECk-MID: tB %bb.2
410 ; CHECK-MID: bb.2.while.end:
411 define void @check_negated_xor_wls(ptr nocapture %a, ptr nocapture readonly %b, i32 %N) {
413 %wls = call {i32, i1} @llvm.test.start.loop.iterations.i32(i32 %N)
414 %wls0 = extractvalue {i32, i1} %wls, 0
415 %wls1 = extractvalue {i32, i1} %wls, 1
416 %xor = xor i1 %wls1, 1
417 br i1 %xor, label %while.end, label %while.body.preheader
419 while.body.preheader:
423 %a.addr.06 = phi ptr [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
424 %b.addr.05 = phi ptr [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
425 %count = phi i32 [ %wls0, %while.body.preheader ], [ %count.next, %while.body ]
426 %incdec.ptr = getelementptr inbounds i16, ptr %b.addr.05, i32 1
427 %ld.b = load i16, ptr %b.addr.05, align 2
428 %incdec.ptr1 = getelementptr inbounds i16, ptr %a.addr.06, i32 1
429 store i16 %ld.b, ptr %a.addr.06, align 2
430 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
431 %cmp = icmp ne i32 %count.next, 0
432 br i1 %cmp, label %while.body, label %while.end
438 ; CHECK-MID: check_negated_cmp_wls
439 ; CHECK-MID: $lr = t2WhileLoopStartLR killed renamable $r2
440 ; CHECK-MID: tB %bb.1
441 ; CHECK-MID: bb.1.while.body:
442 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
443 ; CHECk-MID: tB %bb.2
444 ; CHECK-MID: bb.2.while.end:
445 define void @check_negated_cmp_wls(ptr nocapture %a, ptr nocapture readonly %b, i32 %N) {
447 %wls = call {i32, i1} @llvm.test.start.loop.iterations.i32(i32 %N)
448 %wls0 = extractvalue {i32, i1} %wls, 0
449 %wls1 = extractvalue {i32, i1} %wls, 1
450 %cmp = icmp ne i1 %wls1, 1
451 br i1 %cmp, label %while.end, label %while.body.preheader
453 while.body.preheader:
457 %a.addr.06 = phi ptr [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
458 %b.addr.05 = phi ptr [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
459 %count = phi i32 [ %wls0, %while.body.preheader ], [ %count.next, %while.body ]
460 %incdec.ptr = getelementptr inbounds i16, ptr %b.addr.05, i32 1
461 %ld.b = load i16, ptr %b.addr.05, align 2
462 %incdec.ptr1 = getelementptr inbounds i16, ptr %a.addr.06, i32 1
463 store i16 %ld.b, ptr %a.addr.06, align 2
464 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
465 %cmp.1 = icmp ne i32 %count.next, 0
466 br i1 %cmp.1, label %while.body, label %while.end
472 ; CHECK-MID: check_negated_reordered_wls
473 ; CHECK-MID: $lr = t2WhileLoopStartLR killed renamable $r2
474 ; CHECK-MID: tB %bb.1
475 ; CHECK-MID: bb.1.while.body:
476 ; CHECK-MID: renamable $lr = t2LoopEndDec killed renamable $lr, %bb.1
477 ; CHECk-MID: tB %bb.2
478 ; CHECK-MID: bb.2.while.end:
479 define void @check_negated_reordered_wls(ptr nocapture %a, ptr nocapture readonly %b, i32 %N) {
483 while.body.preheader:
487 %a.addr.06 = phi ptr [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
488 %b.addr.05 = phi ptr [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
489 %count = phi i32 [ %wls0, %while.body.preheader ], [ %count.next, %while.body ]
490 %incdec.ptr = getelementptr inbounds i16, ptr %b.addr.05, i32 1
491 %ld.b = load i16, ptr %b.addr.05, align 2
492 %incdec.ptr1 = getelementptr inbounds i16, ptr %a.addr.06, i32 1
493 store i16 %ld.b, ptr %a.addr.06, align 2
494 %count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
495 %cmp = icmp ne i32 %count.next, 0
496 br i1 %cmp, label %while.body, label %while.end
499 %wls = call {i32, i1} @llvm.test.start.loop.iterations.i32(i32 %N)
500 %wls0 = extractvalue {i32, i1} %wls, 0
501 %wls1 = extractvalue {i32, i1} %wls, 1
502 %xor = xor i1 %wls1, 1
503 br i1 %xor, label %while.end, label %while.body.preheader
509 declare i32 @llvm.start.loop.iterations.i32(i32)
510 declare {i32, i1} @llvm.test.start.loop.iterations.i32(i32)
511 declare i32 @llvm.loop.decrement.reg.i32(i32, i32)