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: sub.w lr, lr, #1
18 ; CHECK-END: cmp.w lr, #0
19 ; CHECK-END: bne.w .LBB0_3
20 ; CHECK-END: b .LBB0_4
22 ; CHECK-END: b .LBB0_2
23 define void @check_loop_dec_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
25 call void @llvm.set.loop.iterations.i32(i32 %N)
26 br label %for.body.preheader
29 %scevgep = getelementptr i32, i32* %a, i32 -1
30 %scevgep4 = getelementptr i32, i32* %c, i32 -1
31 %scevgep8 = getelementptr i32, i32* %b, i32 -1
35 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
36 %ld1 = load i32, i32* %scevgep11, align 4
37 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
38 %ld2 = load i32, i32* %scevgep7, align 4
39 %mul = mul nsw i32 %ld2, %ld1
40 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
41 store i32 %mul, i32* %scevgep3, align 4
42 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
43 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
44 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
45 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
46 %cmp = icmp ne i32 %count.next, 0
47 br i1 %cmp, label %for.header, label %for.cond.cleanup
50 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
51 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
52 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
53 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
60 ; CHECK-MID: name: check_loop_dec_ugt_brcond_combine
61 ; CHECK-MID: bb.2.for.body:
62 ; CHECK-MID: renamable $lr = t2LoopDec killed renamable $lr, 1
63 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
64 ; CHECK-MID: bb.3.for.header:
66 define void @check_loop_dec_ugt_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
68 call void @llvm.set.loop.iterations.i32(i32 %N)
69 br label %for.body.preheader
72 %scevgep = getelementptr i32, i32* %a, i32 -1
73 %scevgep4 = getelementptr i32, i32* %c, i32 -1
74 %scevgep8 = getelementptr i32, i32* %b, i32 -1
78 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
79 %ld1 = load i32, i32* %scevgep11, align 4
80 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
81 %ld2 = load i32, i32* %scevgep7, align 4
82 %mul = mul nsw i32 %ld2, %ld1
83 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
84 store i32 %mul, i32* %scevgep3, align 4
85 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
86 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
87 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
88 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
89 %cmp = icmp ugt i32 %count.next, 0
90 br i1 %cmp, label %for.header, label %for.cond.cleanup
93 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
94 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
95 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
96 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
103 ; CHECK-MID: name: check_loop_dec_ult_brcond_combine
104 ; CHECK-MID: bb.2.for.body:
105 ; CHECK-MID: renamable $lr = t2LoopDec killed renamable $lr, 1
106 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
107 ; CHECK-MID: bb.3.for.header:
108 ; CHECK-MID: tB %bb.2
109 define void @check_loop_dec_ult_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
111 call void @llvm.set.loop.iterations.i32(i32 %N)
112 br label %for.body.preheader
115 %scevgep = getelementptr i32, i32* %a, i32 -1
116 %scevgep4 = getelementptr i32, i32* %c, i32 -1
117 %scevgep8 = getelementptr i32, i32* %b, i32 -1
121 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
122 %ld1 = load i32, i32* %scevgep11, align 4
123 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
124 %ld2 = load i32, i32* %scevgep7, align 4
125 %mul = mul nsw i32 %ld2, %ld1
126 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
127 store i32 %mul, i32* %scevgep3, align 4
128 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
129 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
130 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
131 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
132 %cmp = icmp ult i32 %count.next, 1
133 br i1 %cmp, label %for.cond.cleanup, label %for.header
136 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
137 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
138 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
139 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
146 ; CHECK-MID: name: check_loop_dec_ult_xor_brcond_combine
147 ; CHECK-MIO: bb.2.for.body:
148 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
149 ; CHECK-MID: tB %bb.4, 14
150 ; CHECk-MID: bb.3.for.header:
151 ; CHECK-MID: tB %bb.2
152 define void @check_loop_dec_ult_xor_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
154 call void @llvm.set.loop.iterations.i32(i32 %N)
155 br label %for.body.preheader
158 %scevgep = getelementptr i32, i32* %a, i32 -1
159 %scevgep4 = getelementptr i32, i32* %c, i32 -1
160 %scevgep8 = getelementptr i32, i32* %b, i32 -1
164 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
165 %ld1 = load i32, i32* %scevgep11, align 4
166 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
167 %ld2 = load i32, i32* %scevgep7, align 4
168 %mul = mul nsw i32 %ld2, %ld1
169 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
170 store i32 %mul, i32* %scevgep3, align 4
171 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
172 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
173 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
174 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
175 %cmp = icmp ult i32 %count.next, 1
176 %negate = xor i1 %cmp, 1
177 br i1 %negate, label %for.header, label %for.cond.cleanup
180 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
181 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
182 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
183 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
190 ; CHECK-MID: name: check_loop_dec_sgt_brcond_combine
191 ; CHECK-MIO: bb.2.for.body:
192 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
193 ; CHECK-MID: tB %bb.4, 14
194 ; CHECk-MID: bb.3.for.header:
195 ; CHECK-MID: tB %bb.2
196 define void @check_loop_dec_sgt_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
198 call void @llvm.set.loop.iterations.i32(i32 %N)
199 br label %for.body.preheader
202 %scevgep = getelementptr i32, i32* %a, i32 -1
203 %scevgep4 = getelementptr i32, i32* %c, i32 -1
204 %scevgep8 = getelementptr i32, i32* %b, i32 -1
208 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
209 %ld1 = load i32, i32* %scevgep11, align 4
210 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
211 %ld2 = load i32, i32* %scevgep7, align 4
212 %mul = mul nsw i32 %ld2, %ld1
213 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
214 store i32 %mul, i32* %scevgep3, align 4
215 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
216 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
217 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
218 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
219 %cmp = icmp sgt i32 %count.next, 0
220 br i1 %cmp, label %for.header, label %for.cond.cleanup
223 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
224 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
225 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
226 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
233 ; CHECK-MID: name: check_loop_dec_sge_brcond_combine
234 ; CHECK-MIO: bb.2.for.body:
235 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
236 ; CHECK-MID: tB %bb.4, 14
237 ; CHECk-MID: bb.3.for.header:
238 ; CHECK-MID: tB %bb.2
239 define void @check_loop_dec_sge_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
241 call void @llvm.set.loop.iterations.i32(i32 %N)
242 br label %for.body.preheader
245 %scevgep = getelementptr i32, i32* %a, i32 -1
246 %scevgep4 = getelementptr i32, i32* %c, i32 -1
247 %scevgep8 = getelementptr i32, i32* %b, i32 -1
251 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
252 %ld1 = load i32, i32* %scevgep11, align 4
253 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
254 %ld2 = load i32, i32* %scevgep7, align 4
255 %mul = mul nsw i32 %ld2, %ld1
256 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
257 store i32 %mul, i32* %scevgep3, align 4
258 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
259 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
260 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
261 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
262 %cmp = icmp sge i32 %count.next, 1
263 br i1 %cmp, label %for.header, label %for.cond.cleanup
266 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
267 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
268 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
269 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
276 ; CHECK-MID: name: check_loop_dec_sge_xor_brcond_combine
277 ; CHECK-MIO: bb.2.for.body:
278 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
279 ; CHECK-MID: tB %bb.4, 14
280 ; CHECk-MID: bb.3.for.header:
281 ; CHECK-MID: tB %bb.2
282 define void @check_loop_dec_sge_xor_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
284 call void @llvm.set.loop.iterations.i32(i32 %N)
285 br label %for.body.preheader
288 %scevgep = getelementptr i32, i32* %a, i32 -1
289 %scevgep4 = getelementptr i32, i32* %c, i32 -1
290 %scevgep8 = getelementptr i32, i32* %b, i32 -1
294 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
295 %ld1 = load i32, i32* %scevgep11, align 4
296 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
297 %ld2 = load i32, i32* %scevgep7, align 4
298 %mul = mul nsw i32 %ld2, %ld1
299 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
300 store i32 %mul, i32* %scevgep3, align 4
301 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
302 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
303 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
304 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
305 %cmp = icmp sge i32 %count.next, 1
306 %negated = xor i1 %cmp, 1
307 br i1 %negated, label %for.cond.cleanup, label %for.header
310 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
311 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
312 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
313 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
320 ; CHECK-MID: name: check_loop_dec_uge_brcond_combine
321 ; CHECK-MIO: bb.2.for.body:
322 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
323 ; CHECK-MID: tB %bb.4, 14
324 ; CHECk-MID: bb.3.for.header:
325 ; CHECK-MID: tB %bb.2
326 define void @check_loop_dec_uge_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
328 call void @llvm.set.loop.iterations.i32(i32 %N)
329 br label %for.body.preheader
332 %scevgep = getelementptr i32, i32* %a, i32 -1
333 %scevgep4 = getelementptr i32, i32* %c, i32 -1
334 %scevgep8 = getelementptr i32, i32* %b, i32 -1
338 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
339 %ld1 = load i32, i32* %scevgep11, align 4
340 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
341 %ld2 = load i32, i32* %scevgep7, align 4
342 %mul = mul nsw i32 %ld2, %ld1
343 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
344 store i32 %mul, i32* %scevgep3, align 4
345 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
346 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
347 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
348 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
349 %cmp = icmp uge i32 %count.next, 1
350 br i1 %cmp, label %for.header, label %for.cond.cleanup
353 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
354 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
355 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
356 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
363 ; CHECK-MID: name: check_loop_dec_uge_xor_brcond_combine
364 ; CHECK-MIO: bb.2.for.body:
365 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.3
366 ; CHECK-MID: tB %bb.4, 14
367 ; CHECk-MID: bb.3.for.header:
368 ; CHECK-MID: tB %bb.2
369 define void @check_loop_dec_uge_xor_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
371 call void @llvm.set.loop.iterations.i32(i32 %N)
372 br label %for.body.preheader
375 %scevgep = getelementptr i32, i32* %a, i32 -1
376 %scevgep4 = getelementptr i32, i32* %c, i32 -1
377 %scevgep8 = getelementptr i32, i32* %b, i32 -1
381 %scevgep11 = getelementptr i32, i32* %lsr.iv9, i32 1
382 %ld1 = load i32, i32* %scevgep11, align 4
383 %scevgep7 = getelementptr i32, i32* %lsr.iv5, i32 1
384 %ld2 = load i32, i32* %scevgep7, align 4
385 %mul = mul nsw i32 %ld2, %ld1
386 %scevgep3 = getelementptr i32, i32* %lsr.iv1, i32 1
387 store i32 %mul, i32* %scevgep3, align 4
388 %scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
389 %scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
390 %scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
391 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
392 %cmp = icmp uge i32 %count.next, 1
393 %negated = xor i1 %cmp, 1
394 br i1 %negated, label %for.cond.cleanup, label %for.header
397 %lsr.iv9 = phi i32* [ %scevgep8, %for.body.preheader ], [ %scevgep10, %for.body ]
398 %lsr.iv5 = phi i32* [ %scevgep4, %for.body.preheader ], [ %scevgep6, %for.body ]
399 %lsr.iv1 = phi i32* [ %scevgep, %for.body.preheader ], [ %scevgep2, %for.body ]
400 %count = phi i32 [ %N, %for.body.preheader ], [ %count.next, %for.body ]
407 ; CHECK-MID: check_negated_xor_wls
408 ; CHECK-MID: t2WhileLoopStart killed renamable $r2, %bb.3
409 ; CHECK-MID: tB %bb.1
410 ; CHECK-MID: bb.1.while.body.preheader:
411 ; CHECK-MID: $lr = t2LoopDec killed renamable $lr, 1
412 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.2
413 ; CHECk-MID: tB %bb.3
414 ; CHECK-MID: bb.3.while.end:
415 define void @check_negated_xor_wls(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
417 %wls = call i1 @llvm.test.set.loop.iterations.i32(i32 %N)
418 %xor = xor i1 %wls, 1
419 br i1 %xor, label %while.end, label %while.body.preheader
421 while.body.preheader:
425 %a.addr.06 = phi i16* [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
426 %b.addr.05 = phi i16* [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
427 %count = phi i32 [ %N, %while.body.preheader ], [ %count.next, %while.body ]
428 %incdec.ptr = getelementptr inbounds i16, i16* %b.addr.05, i32 1
429 %ld.b = load i16, i16* %b.addr.05, align 2
430 %incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
431 store i16 %ld.b, i16* %a.addr.06, align 2
432 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
433 %cmp = icmp ne i32 %count.next, 0
434 br i1 %cmp, label %while.body, label %while.end
440 ; CHECK-MID: check_negated_cmp_wls
441 ; CHECK-MID: t2WhileLoopStart killed renamable $r2, %bb.3
442 ; CHECK-MID: tB %bb.1
443 ; CHECK-MID: bb.1.while.body.preheader:
444 ; CHECK-MID: $lr = t2LoopDec killed renamable $lr, 1
445 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.2
446 ; CHECk-MID: tB %bb.3
447 ; CHECK-MID: bb.3.while.end:
448 define void @check_negated_cmp_wls(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
450 %wls = call i1 @llvm.test.set.loop.iterations.i32(i32 %N)
451 %cmp = icmp ne i1 %wls, 1
452 br i1 %cmp, label %while.end, label %while.body.preheader
454 while.body.preheader:
458 %a.addr.06 = phi i16* [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
459 %b.addr.05 = phi i16* [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
460 %count = phi i32 [ %N, %while.body.preheader ], [ %count.next, %while.body ]
461 %incdec.ptr = getelementptr inbounds i16, i16* %b.addr.05, i32 1
462 %ld.b = load i16, i16* %b.addr.05, align 2
463 %incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
464 store i16 %ld.b, i16* %a.addr.06, align 2
465 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
466 %cmp.1 = icmp ne i32 %count.next, 0
467 br i1 %cmp.1, label %while.body, label %while.end
473 ; CHECK-MID: check_negated_reordered_wls
474 ; CHECK-MID: bb.1.while.body.preheader:
475 ; CHECK-MID: tB %bb.2
476 ; CHECK-MID: bb.2.while.body:
477 ; CHECK-MID: t2LoopDec killed renamable $lr, 1
478 ; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.2
479 ; CHECK-MID: tB %bb.4
480 ; CHECK-MID: bb.3.while:
481 ; CHECK-MID: t2WhileLoopStart {{.*}}, %bb.4
482 ; CHECK-MID: bb.4.while.end
483 define void @check_negated_reordered_wls(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
487 while.body.preheader:
491 %a.addr.06 = phi i16* [ %incdec.ptr1, %while.body ], [ %a, %while.body.preheader ]
492 %b.addr.05 = phi i16* [ %incdec.ptr, %while.body ], [ %b, %while.body.preheader ]
493 %count = phi i32 [ %N, %while.body.preheader ], [ %count.next, %while.body ]
494 %incdec.ptr = getelementptr inbounds i16, i16* %b.addr.05, i32 1
495 %ld.b = load i16, i16* %b.addr.05, align 2
496 %incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
497 store i16 %ld.b, i16* %a.addr.06, align 2
498 %count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
499 %cmp = icmp ne i32 %count.next, 0
500 br i1 %cmp, label %while.body, label %while.end
503 %wls = call i1 @llvm.test.set.loop.iterations.i32(i32 %N)
504 %xor = xor i1 %wls, 1
505 br i1 %xor, label %while.end, label %while.body.preheader
511 declare void @llvm.set.loop.iterations.i32(i32)
512 declare i1 @llvm.test.set.loop.iterations.i32(i32)
513 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32)