1 ; RUN: llc -mtriple=thumbv8.1m.main -O0 -mattr=+lob -disable-arm-loloops=false -stop-before=arm-low-overhead-loops %s -o - | FileCheck %s --check-prefix=CHECK-MID
2 ; RUN: llc -mtriple=thumbv8.1m.main -O0 -mattr=+lob -disable-arm-loloops=false -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK-END
4 ; Test that the branch targets are correct after isel, even though the loop
5 ; will sometimes be reverted anyway.
7 ; CHECK-MID: name: check_loop_dec_brcond_combine
8 ; CHECK-MID: bb.2.for.body:
9 ; CHECK-MID: renamable $lr = t2LoopDec killed renamable $lr, 1
10 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
11 ; CHECK-MID: bb.3.for.header:
15 ; CHECK-END: b .LBB0_3
17 ; CHECK-END: subs.w lr, lr, #1
18 ; CHECK-END: bne .LBB0_3
19 ; CHECK-END: b .LBB0_4
21 ; CHECK-END: b .LBB0_2
22 define void @check_loop_dec_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
24 call void @llvm.set.loop.iterations.i32(i32 %N)
25 br label %for.body.preheader
28 %scevgep = getelementptr i32, i32* %a, i32 -1
29 %scevgep4 = getelementptr i32, i32* %c, i32 -1
30 %scevgep8 = getelementptr i32, i32* %b, i32 -1
34 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
35 %ld1 = load i32, i32* %scevgep11, align 4
36 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
37 %ld2 = load i32, i32* %scevgep7, align 4
38 %mul = mul nsw i32 %ld2, %ld1
39 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
40 store i32 %mul, i32* %scevgep3, align 4
41 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
42 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
43 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
44 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
45 %cmp = icmp ne i32 %count.next, 0
46 br i1 %cmp, label %for.header, label %for.cond.cleanup
49 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
50 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
51 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
52 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
59 ; CHECK-MID: name: check_loop_dec_ugt_brcond_combine
60 ; CHECK-MID: bb.2.for.body:
61 ; CHECK-MID: renamable $lr = t2LoopDec killed renamable $lr, 1
62 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
63 ; CHECK-MID: bb.3.for.header:
65 define void @check_loop_dec_ugt_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
67 call void @llvm.set.loop.iterations.i32(i32 %N)
68 br label %for.body.preheader
71 %scevgep = getelementptr i32, i32* %a, i32 -1
72 %scevgep4 = getelementptr i32, i32* %c, i32 -1
73 %scevgep8 = getelementptr i32, i32* %b, i32 -1
77 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
78 %ld1 = load i32, i32* %scevgep11, align 4
79 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
80 %ld2 = load i32, i32* %scevgep7, align 4
81 %mul = mul nsw i32 %ld2, %ld1
82 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
83 store i32 %mul, i32* %scevgep3, align 4
84 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
85 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
86 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
87 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
88 %cmp = icmp ugt i32 %count.next, 0
89 br i1 %cmp, label %for.header, label %for.cond.cleanup
92 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
93 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
94 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
95 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
102 ; CHECK-MID: name: check_loop_dec_ult_brcond_combine
103 ; CHECK-MID: bb.2.for.body:
104 ; CHECK-MID: renamable $lr = t2LoopDec killed renamable $lr, 1
105 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
106 ; CHECK-MID: bb.3.for.header:
107 ; CHECK-MID: tB %bb.2
108 define void @check_loop_dec_ult_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
110 call void @llvm.set.loop.iterations.i32(i32 %N)
111 br label %for.body.preheader
114 %scevgep = getelementptr i32, i32* %a, i32 -1
115 %scevgep4 = getelementptr i32, i32* %c, i32 -1
116 %scevgep8 = getelementptr i32, i32* %b, i32 -1
120 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
121 %ld1 = load i32, i32* %scevgep11, align 4
122 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
123 %ld2 = load i32, i32* %scevgep7, align 4
124 %mul = mul nsw i32 %ld2, %ld1
125 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
126 store i32 %mul, i32* %scevgep3, align 4
127 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
128 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
129 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
130 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
131 %cmp = icmp ult i32 %count.next, 1
132 br i1 %cmp, label %for.cond.cleanup, label %for.header
135 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
136 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
137 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
138 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
145 ; CHECK-MID: name: check_loop_dec_ult_xor_brcond_combine
146 ; CHECK-MIO: bb.2.for.body:
147 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
148 ; CHECK-MID: tB %bb.4, 14
149 ; CHECk-MID: bb.3.for.header:
150 ; CHECK-MID: tB %bb.2
151 define void @check_loop_dec_ult_xor_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
153 call void @llvm.set.loop.iterations.i32(i32 %N)
154 br label %for.body.preheader
157 %scevgep = getelementptr i32, i32* %a, i32 -1
158 %scevgep4 = getelementptr i32, i32* %c, i32 -1
159 %scevgep8 = getelementptr i32, i32* %b, i32 -1
163 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
164 %ld1 = load i32, i32* %scevgep11, align 4
165 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
166 %ld2 = load i32, i32* %scevgep7, align 4
167 %mul = mul nsw i32 %ld2, %ld1
168 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
169 store i32 %mul, i32* %scevgep3, align 4
170 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
171 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
172 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
173 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
174 %cmp = icmp ult i32 %count.next, 1
175 %negate = xor i1 %cmp, 1
176 br i1 %negate, label %for.header, label %for.cond.cleanup
179 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
180 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
181 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
182 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
189 ; CHECK-MID: name: check_loop_dec_sgt_brcond_combine
190 ; CHECK-MIO: bb.2.for.body:
191 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
192 ; CHECK-MID: tB %bb.4, 14
193 ; CHECk-MID: bb.3.for.header:
194 ; CHECK-MID: tB %bb.2
195 define void @check_loop_dec_sgt_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
197 call void @llvm.set.loop.iterations.i32(i32 %N)
198 br label %for.body.preheader
201 %scevgep = getelementptr i32, i32* %a, i32 -1
202 %scevgep4 = getelementptr i32, i32* %c, i32 -1
203 %scevgep8 = getelementptr i32, i32* %b, i32 -1
207 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
208 %ld1 = load i32, i32* %scevgep11, align 4
209 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
210 %ld2 = load i32, i32* %scevgep7, align 4
211 %mul = mul nsw i32 %ld2, %ld1
212 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
213 store i32 %mul, i32* %scevgep3, align 4
214 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
215 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
216 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
217 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
218 %cmp = icmp sgt i32 %count.next, 0
219 br i1 %cmp, label %for.header, label %for.cond.cleanup
222 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
223 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
224 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
225 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
232 ; CHECK-MID: name: check_loop_dec_sge_brcond_combine
233 ; CHECK-MIO: bb.2.for.body:
234 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
235 ; CHECK-MID: tB %bb.4, 14
236 ; CHECk-MID: bb.3.for.header:
237 ; CHECK-MID: tB %bb.2
238 define void @check_loop_dec_sge_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
240 call void @llvm.set.loop.iterations.i32(i32 %N)
241 br label %for.body.preheader
244 %scevgep = getelementptr i32, i32* %a, i32 -1
245 %scevgep4 = getelementptr i32, i32* %c, i32 -1
246 %scevgep8 = getelementptr i32, i32* %b, i32 -1
250 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
251 %ld1 = load i32, i32* %scevgep11, align 4
252 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
253 %ld2 = load i32, i32* %scevgep7, align 4
254 %mul = mul nsw i32 %ld2, %ld1
255 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
256 store i32 %mul, i32* %scevgep3, align 4
257 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
258 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
259 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
260 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
261 %cmp = icmp sge i32 %count.next, 1
262 br i1 %cmp, label %for.header, label %for.cond.cleanup
265 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
266 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
267 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
268 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
275 ; CHECK-MID: name: check_loop_dec_sge_xor_brcond_combine
276 ; CHECK-MIO: bb.2.for.body:
277 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
278 ; CHECK-MID: tB %bb.4, 14
279 ; CHECk-MID: bb.3.for.header:
280 ; CHECK-MID: tB %bb.2
281 define void @check_loop_dec_sge_xor_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
283 call void @llvm.set.loop.iterations.i32(i32 %N)
284 br label %for.body.preheader
287 %scevgep = getelementptr i32, i32* %a, i32 -1
288 %scevgep4 = getelementptr i32, i32* %c, i32 -1
289 %scevgep8 = getelementptr i32, i32* %b, i32 -1
293 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
294 %ld1 = load i32, i32* %scevgep11, align 4
295 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
296 %ld2 = load i32, i32* %scevgep7, align 4
297 %mul = mul nsw i32 %ld2, %ld1
298 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
299 store i32 %mul, i32* %scevgep3, align 4
300 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
301 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
302 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
303 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
304 %cmp = icmp sge i32 %count.next, 1
305 %negated = xor i1 %cmp, 1
306 br i1 %negated, label %for.cond.cleanup, label %for.header
309 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
310 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
311 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
312 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
319 ; CHECK-MID: name: check_loop_dec_uge_brcond_combine
320 ; CHECK-MIO: bb.2.for.body:
321 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
322 ; CHECK-MID: tB %bb.4, 14
323 ; CHECk-MID: bb.3.for.header:
324 ; CHECK-MID: tB %bb.2
325 define void @check_loop_dec_uge_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
327 call void @llvm.set.loop.iterations.i32(i32 %N)
328 br label %for.body.preheader
331 %scevgep = getelementptr i32, i32* %a, i32 -1
332 %scevgep4 = getelementptr i32, i32* %c, i32 -1
333 %scevgep8 = getelementptr i32, i32* %b, i32 -1
337 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
338 %ld1 = load i32, i32* %scevgep11, align 4
339 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
340 %ld2 = load i32, i32* %scevgep7, align 4
341 %mul = mul nsw i32 %ld2, %ld1
342 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
343 store i32 %mul, i32* %scevgep3, align 4
344 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
345 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
346 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
347 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
348 %cmp = icmp uge i32 %count.next, 1
349 br i1 %cmp, label %for.header, label %for.cond.cleanup
352 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
353 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
354 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
355 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
362 ; CHECK-MID: name: check_loop_dec_uge_xor_brcond_combine
363 ; CHECK-MIO: bb.2.for.body:
364 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
365 ; CHECK-MID: tB %bb.4, 14
366 ; CHECk-MID: bb.3.for.header:
367 ; CHECK-MID: tB %bb.2
368 define void @check_loop_dec_uge_xor_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
370 call void @llvm.set.loop.iterations.i32(i32 %N)
371 br label %for.body.preheader
374 %scevgep = getelementptr i32, i32* %a, i32 -1
375 %scevgep4 = getelementptr i32, i32* %c, i32 -1
376 %scevgep8 = getelementptr i32, i32* %b, i32 -1
380 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
381 %ld1 = load i32, i32* %scevgep11, align 4
382 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
383 %ld2 = load i32, i32* %scevgep7, align 4
384 %mul = mul nsw i32 %ld2, %ld1
385 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
386 store i32 %mul, i32* %scevgep3, align 4
387 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
388 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
389 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
390 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
391 %cmp = icmp uge i32 %count.next, 1
392 %negated = xor i1 %cmp, 1
393 br i1 %negated, label %for.cond.cleanup, label %for.header
396 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
397 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
398 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
399 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
406 ; CHECK-MID: check_negated_xor_wls
407 ; CHECK-MID: t2WhileLoopStart killed renamable $r2, %bb.3
408 ; CHECK-MID: tB %bb.1
409 ; CHECK-MID: bb.1.while.body.preheader:
410 ; CHECK-MID: $lr = t2LoopDec killed renamable $lr, 1
411 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.2
412 ; CHECk-MID: tB %bb.3
413 ; CHECK-MID: bb.3.while.end:
414 define void @check_negated_xor_wls(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
416 %wls = call i1 @llvm.test.set.loop.iterations.i32(i32 %N)
417 %xor = xor i1 %wls, 1
418 br i1 %xor, label %while.end, label %while.body.preheader
420 while.body.preheader:
424 %a.addr.06 = phi i16* [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
425 %b.addr.05 = phi i16* [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
426 %count = phi i32 [ %N, %while.body.preheader ], [ %count.next, %while.body ]
427 %incdec.ptr = getelementptr inbounds i16, i16* %b.addr.05, i32 1
428 %ld.b = load i16, i16* %b.addr.05, align 2
429 %incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
430 store i16 %ld.b, i16* %a.addr.06, align 2
431 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
432 %cmp = icmp ne i32 %count.next, 0
433 br i1 %cmp, label %while.body, label %while.end
439 ; CHECK-MID: check_negated_cmp_wls
440 ; CHECK-MID: t2WhileLoopStart killed renamable $r2, %bb.3
441 ; CHECK-MID: tB %bb.1
442 ; CHECK-MID: bb.1.while.body.preheader:
443 ; CHECK-MID: $lr = t2LoopDec killed renamable $lr, 1
444 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.2
445 ; CHECk-MID: tB %bb.3
446 ; CHECK-MID: bb.3.while.end:
447 define void @check_negated_cmp_wls(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
449 %wls = call i1 @llvm.test.set.loop.iterations.i32(i32 %N)
450 %cmp = icmp ne i1 %wls, 1
451 br i1 %cmp, label %while.end, label %while.body.preheader
453 while.body.preheader:
457 %a.addr.06 = phi i16* [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
458 %b.addr.05 = phi i16* [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
459 %count = phi i32 [ %N, %while.body.preheader ], [ %count.next, %while.body ]
460 %incdec.ptr = getelementptr inbounds i16, i16* %b.addr.05, i32 1
461 %ld.b = load i16, i16* %b.addr.05, align 2
462 %incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
463 store i16 %ld.b, i16* %a.addr.06, align 2
464 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.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: bb.1.while.body.preheader:
474 ; CHECK-MID: tB %bb.2
475 ; CHECK-MID: bb.2.while.body:
476 ; CHECK-MID: t2LoopDec killed renamable $lr, 1
477 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.2
478 ; CHECK-MID: tB %bb.4
479 ; CHECK-MID: bb.3.while:
480 ; CHECK-MID: t2WhileLoopStart {{.*}}, %bb.4
481 ; CHECK-MID: bb.4.while.end
482 define void @check_negated_reordered_wls(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
486 while.body.preheader:
490 %a.addr.06 = phi i16* [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
491 %b.addr.05 = phi i16* [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
492 %count = phi i32 [ %N, %while.body.preheader ], [ %count.next, %while.body ]
493 %incdec.ptr = getelementptr inbounds i16, i16* %b.addr.05, i32 1
494 %ld.b = load i16, i16* %b.addr.05, align 2
495 %incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
496 store i16 %ld.b, i16* %a.addr.06, align 2
497 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
498 %cmp = icmp ne i32 %count.next, 0
499 br i1 %cmp, label %while.body, label %while.end
502 %wls = call i1 @llvm.test.set.loop.iterations.i32(i32 %N)
503 %xor = xor i1 %wls, 1
504 br i1 %xor, label %while.end, label %while.body.preheader
510 declare void @llvm.set.loop.iterations.i32(i32)
511 declare i1 @llvm.test.set.loop.iterations.i32(i32)
512 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32)