Skip to content

Commit 54e2876

Browse files
committed
[ARM] Update and add extra WLS testing. NFC
1 parent 53d3038 commit 54e2876

File tree

3 files changed

+300
-223
lines changed

3 files changed

+300
-223
lines changed

llvm/test/CodeGen/Thumb2/LowOverheadLoops/branch-targets.ll

Lines changed: 80 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
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
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
32

43
; Test that the branch targets are correct after isel, even though the loop
54
; will sometimes be reverted anyway.
65

76
; 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:
12-
; CHECK-MID: tB %bb.2
13-
14-
; CHECK-END: .LBB0_1:
15-
; CHECK-END: b .LBB0_3
16-
; CHECK-END: .LBB0_2:
17-
; CHECK-END: subs.w lr, lr, #1
18-
; CHECK-END: bne .LBB0_3
19-
; CHECK-END: b .LBB0_4
20-
; CHECK-END: .LBB0_3:
21-
; CHECK-END: b .LBB0_2
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:
2212
define void @check_loop_dec_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
2313
entry:
2414
%start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
@@ -41,7 +31,7 @@ for.body:
4131
%scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
4232
%scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
4333
%scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
44-
%count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
34+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
4535
%cmp = icmp ne i32 %count.next, 0
4636
br i1 %cmp, label %for.header, label %for.cond.cleanup
4737

@@ -57,11 +47,12 @@ for.cond.cleanup:
5747
}
5848

5949
; 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:
64-
; CHECK-MID: tB %bb.2
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:
6556
define void @check_loop_dec_ugt_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
6657
entry:
6758
%start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
@@ -84,7 +75,7 @@ for.body:
8475
%scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
8576
%scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
8677
%scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
87-
%count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
78+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
8879
%cmp = icmp ugt i32 %count.next, 0
8980
br i1 %cmp, label %for.header, label %for.cond.cleanup
9081

@@ -100,11 +91,12 @@ for.cond.cleanup:
10091
}
10192

10293
; 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
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:
108100
define void @check_loop_dec_ult_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
109101
entry:
110102
%start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
@@ -127,7 +119,7 @@ for.body:
127119
%scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
128120
%scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
129121
%scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
130-
%count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
122+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
131123
%cmp = icmp ult i32 %count.next, 1
132124
br i1 %cmp, label %for.cond.cleanup, label %for.header
133125

@@ -143,11 +135,12 @@ for.cond.cleanup:
143135
}
144136

145137
; 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
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:
151144
define void @check_loop_dec_ult_xor_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
152145
entry:
153146
%start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
@@ -170,7 +163,7 @@ for.body:
170163
%scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
171164
%scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
172165
%scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
173-
%count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
166+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
174167
%cmp = icmp ult i32 %count.next, 1
175168
%negate = xor i1 %cmp, 1
176169
br i1 %negate, label %for.header, label %for.cond.cleanup
@@ -187,11 +180,12 @@ for.cond.cleanup:
187180
}
188181

189182
; 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
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:
195189
define void @check_loop_dec_sgt_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
196190
entry:
197191
%start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
@@ -214,7 +208,7 @@ for.body:
214208
%scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
215209
%scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
216210
%scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
217-
%count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
211+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
218212
%cmp = icmp sgt i32 %count.next, 0
219213
br i1 %cmp, label %for.header, label %for.cond.cleanup
220214

@@ -230,11 +224,12 @@ for.cond.cleanup:
230224
}
231225

232226
; 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
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:
238233
define void @check_loop_dec_sge_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
239234
entry:
240235
%start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
@@ -257,7 +252,7 @@ for.body:
257252
%scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
258253
%scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
259254
%scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
260-
%count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
255+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
261256
%cmp = icmp sge i32 %count.next, 1
262257
br i1 %cmp, label %for.header, label %for.cond.cleanup
263258

@@ -273,11 +268,12 @@ for.cond.cleanup:
273268
}
274269

275270
; 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
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:
281277
define void @check_loop_dec_sge_xor_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
282278
entry:
283279
%start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
@@ -300,7 +296,7 @@ for.body:
300296
%scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
301297
%scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
302298
%scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
303-
%count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
299+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
304300
%cmp = icmp sge i32 %count.next, 1
305301
%negated = xor i1 %cmp, 1
306302
br i1 %negated, label %for.cond.cleanup, label %for.header
@@ -317,11 +313,12 @@ for.cond.cleanup:
317313
}
318314

319315
; 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
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:
325322
define void @check_loop_dec_uge_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
326323
entry:
327324
%start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
@@ -344,7 +341,7 @@ for.body:
344341
%scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
345342
%scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
346343
%scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
347-
%count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
344+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
348345
%cmp = icmp uge i32 %count.next, 1
349346
br i1 %cmp, label %for.header, label %for.cond.cleanup
350347

@@ -360,11 +357,12 @@ for.cond.cleanup:
360357
}
361358

362359
; 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
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:
368366
define void @check_loop_dec_uge_xor_brcond_combine(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
369367
entry:
370368
%start = call i32 @llvm.start.loop.iterations.i32(i32 %N)
@@ -387,7 +385,7 @@ for.body:
387385
%scevgep2 = getelementptr i32, i32* %lsr.iv1, i32 1
388386
%scevgep6 = getelementptr i32, i32* %lsr.iv5, i32 1
389387
%scevgep10 = getelementptr i32, i32* %lsr.iv9, i32 1
390-
%count.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %count, i32 1)
388+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
391389
%cmp = icmp uge i32 %count.next, 1
392390
%negated = xor i1 %cmp, 1
393391
br i1 %negated, label %for.cond.cleanup, label %for.header
@@ -404,11 +402,11 @@ for.cond.cleanup:
404402
}
405403

406404
; CHECK-MID: check_negated_xor_wls
407-
; CHECK-MID: t2WhileLoopStart renamable $r2, %bb.3
408-
; CHECK-MID: tB %bb.1
405+
; CHECK-MID: t2WhileLoopStart $r2, %bb.3
406+
; CHECK-MID: tB %bb.1
409407
; CHECK-MID: bb.1.while.body.preheader:
410408
; CHECK-MID: $lr = t2LoopDec killed renamable $lr, 1
411-
; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.2
409+
; CHECK-MID: t2LoopEnd renamable $lr, %bb.2, implicit-def dead $cpsr
412410
; CHECk-MID: tB %bb.3
413411
; CHECK-MID: bb.3.while.end:
414412
define void @check_negated_xor_wls(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
@@ -428,7 +426,7 @@ while.body:
428426
%ld.b = load i16, i16* %b.addr.05, align 2
429427
%incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
430428
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)
429+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
432430
%cmp = icmp ne i32 %count.next, 0
433431
br i1 %cmp, label %while.body, label %while.end
434432

@@ -437,11 +435,11 @@ while.end:
437435
}
438436

439437
; CHECK-MID: check_negated_cmp_wls
440-
; CHECK-MID: t2WhileLoopStart renamable $r2, %bb.3
441-
; CHECK-MID: tB %bb.1
438+
; CHECK-MID: t2WhileLoopStart $r2, %bb.3
439+
; CHECK-MID: tB %bb.1
442440
; CHECK-MID: bb.1.while.body.preheader:
443441
; CHECK-MID: $lr = t2LoopDec killed renamable $lr, 1
444-
; CHECK-MID: t2LoopEnd killed renamable $lr, %bb.2
442+
; CHECK-MID: t2LoopEnd renamable $lr, %bb.2
445443
; CHECk-MID: tB %bb.3
446444
; CHECK-MID: bb.3.while.end:
447445
define void @check_negated_cmp_wls(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
@@ -461,7 +459,7 @@ while.body:
461459
%ld.b = load i16, i16* %b.addr.05, align 2
462460
%incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
463461
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)
462+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
465463
%cmp.1 = icmp ne i32 %count.next, 0
466464
br i1 %cmp.1, label %while.body, label %while.end
467465

@@ -470,15 +468,13 @@ while.end:
470468
}
471469

472470
; 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
471+
; CHECK-MID: t2WhileLoopStart killed $r2, %bb.2
472+
; CHECK-MID: tB %bb.1
473+
; CHECK-MID: bb.1.while.body:
474+
; CHECK-MID: $lr = t2LoopDec killed renamable $lr, 1
475+
; CHECK-MID: t2LoopEnd renamable $lr, %bb.1
476+
; CHECk-MID: tB %bb.2
477+
; CHECK-MID: bb.2.while.end:
482478
define void @check_negated_reordered_wls(i16* nocapture %a, i16* nocapture readonly %b, i32 %N) {
483479
entry:
484480
br label %while
@@ -494,7 +490,7 @@ while.body:
494490
%ld.b = load i16, i16* %b.addr.05, align 2
495491
%incdec.ptr1 = getelementptr inbounds i16, i16* %a.addr.06, i32 1
496492
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)
493+
%count.next = call i32 @llvm.loop.decrement.reg.i32(i32 %count, i32 1)
498494
%cmp = icmp ne i32 %count.next, 0
499495
br i1 %cmp, label %while.body, label %while.end
500496

@@ -509,4 +505,4 @@ while.end:
509505

510506
declare i32 @llvm.start.loop.iterations.i32(i32)
511507
declare i1 @llvm.test.set.loop.iterations.i32(i32)
512-
declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32)
508+
declare i32 @llvm.loop.decrement.reg.i32(i32, i32)

0 commit comments

Comments
 (0)