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
3
2
4
3
; Test that the branch targets are correct after isel, even though the loop
5
4
; will sometimes be reverted anyway.
6
5
7
6
; 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:
22
12
define void @check_loop_dec_brcond_combine (i32* nocapture %a , i32* nocapture readonly %b , i32* nocapture readonly %c , i32 %N ) {
23
13
entry:
24
14
%start = call i32 @llvm.start.loop.iterations.i32 (i32 %N )
@@ -41,7 +31,7 @@ for.body:
41
31
%scevgep2 = getelementptr i32 , i32* %lsr.iv1 , i32 1
42
32
%scevgep6 = getelementptr i32 , i32* %lsr.iv5 , i32 1
43
33
%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 )
45
35
%cmp = icmp ne i32 %count.next , 0
46
36
br i1 %cmp , label %for.header , label %for.cond.cleanup
47
37
@@ -57,11 +47,12 @@ for.cond.cleanup:
57
47
}
58
48
59
49
; 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:
65
56
define void @check_loop_dec_ugt_brcond_combine (i32* nocapture %a , i32* nocapture readonly %b , i32* nocapture readonly %c , i32 %N ) {
66
57
entry:
67
58
%start = call i32 @llvm.start.loop.iterations.i32 (i32 %N )
@@ -84,7 +75,7 @@ for.body:
84
75
%scevgep2 = getelementptr i32 , i32* %lsr.iv1 , i32 1
85
76
%scevgep6 = getelementptr i32 , i32* %lsr.iv5 , i32 1
86
77
%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 )
88
79
%cmp = icmp ugt i32 %count.next , 0
89
80
br i1 %cmp , label %for.header , label %for.cond.cleanup
90
81
@@ -100,11 +91,12 @@ for.cond.cleanup:
100
91
}
101
92
102
93
; 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:
108
100
define void @check_loop_dec_ult_brcond_combine (i32* nocapture %a , i32* nocapture readonly %b , i32* nocapture readonly %c , i32 %N ) {
109
101
entry:
110
102
%start = call i32 @llvm.start.loop.iterations.i32 (i32 %N )
@@ -127,7 +119,7 @@ for.body:
127
119
%scevgep2 = getelementptr i32 , i32* %lsr.iv1 , i32 1
128
120
%scevgep6 = getelementptr i32 , i32* %lsr.iv5 , i32 1
129
121
%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 )
131
123
%cmp = icmp ult i32 %count.next , 1
132
124
br i1 %cmp , label %for.cond.cleanup , label %for.header
133
125
@@ -143,11 +135,12 @@ for.cond.cleanup:
143
135
}
144
136
145
137
; 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:
151
144
define void @check_loop_dec_ult_xor_brcond_combine (i32* nocapture %a , i32* nocapture readonly %b , i32* nocapture readonly %c , i32 %N ) {
152
145
entry:
153
146
%start = call i32 @llvm.start.loop.iterations.i32 (i32 %N )
@@ -170,7 +163,7 @@ for.body:
170
163
%scevgep2 = getelementptr i32 , i32* %lsr.iv1 , i32 1
171
164
%scevgep6 = getelementptr i32 , i32* %lsr.iv5 , i32 1
172
165
%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 )
174
167
%cmp = icmp ult i32 %count.next , 1
175
168
%negate = xor i1 %cmp , 1
176
169
br i1 %negate , label %for.header , label %for.cond.cleanup
@@ -187,11 +180,12 @@ for.cond.cleanup:
187
180
}
188
181
189
182
; 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:
195
189
define void @check_loop_dec_sgt_brcond_combine (i32* nocapture %a , i32* nocapture readonly %b , i32* nocapture readonly %c , i32 %N ) {
196
190
entry:
197
191
%start = call i32 @llvm.start.loop.iterations.i32 (i32 %N )
@@ -214,7 +208,7 @@ for.body:
214
208
%scevgep2 = getelementptr i32 , i32* %lsr.iv1 , i32 1
215
209
%scevgep6 = getelementptr i32 , i32* %lsr.iv5 , i32 1
216
210
%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 )
218
212
%cmp = icmp sgt i32 %count.next , 0
219
213
br i1 %cmp , label %for.header , label %for.cond.cleanup
220
214
@@ -230,11 +224,12 @@ for.cond.cleanup:
230
224
}
231
225
232
226
; 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:
238
233
define void @check_loop_dec_sge_brcond_combine (i32* nocapture %a , i32* nocapture readonly %b , i32* nocapture readonly %c , i32 %N ) {
239
234
entry:
240
235
%start = call i32 @llvm.start.loop.iterations.i32 (i32 %N )
@@ -257,7 +252,7 @@ for.body:
257
252
%scevgep2 = getelementptr i32 , i32* %lsr.iv1 , i32 1
258
253
%scevgep6 = getelementptr i32 , i32* %lsr.iv5 , i32 1
259
254
%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 )
261
256
%cmp = icmp sge i32 %count.next , 1
262
257
br i1 %cmp , label %for.header , label %for.cond.cleanup
263
258
@@ -273,11 +268,12 @@ for.cond.cleanup:
273
268
}
274
269
275
270
; 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:
281
277
define void @check_loop_dec_sge_xor_brcond_combine (i32* nocapture %a , i32* nocapture readonly %b , i32* nocapture readonly %c , i32 %N ) {
282
278
entry:
283
279
%start = call i32 @llvm.start.loop.iterations.i32 (i32 %N )
@@ -300,7 +296,7 @@ for.body:
300
296
%scevgep2 = getelementptr i32 , i32* %lsr.iv1 , i32 1
301
297
%scevgep6 = getelementptr i32 , i32* %lsr.iv5 , i32 1
302
298
%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 )
304
300
%cmp = icmp sge i32 %count.next , 1
305
301
%negated = xor i1 %cmp , 1
306
302
br i1 %negated , label %for.cond.cleanup , label %for.header
@@ -317,11 +313,12 @@ for.cond.cleanup:
317
313
}
318
314
319
315
; 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:
325
322
define void @check_loop_dec_uge_brcond_combine (i32* nocapture %a , i32* nocapture readonly %b , i32* nocapture readonly %c , i32 %N ) {
326
323
entry:
327
324
%start = call i32 @llvm.start.loop.iterations.i32 (i32 %N )
@@ -344,7 +341,7 @@ for.body:
344
341
%scevgep2 = getelementptr i32 , i32* %lsr.iv1 , i32 1
345
342
%scevgep6 = getelementptr i32 , i32* %lsr.iv5 , i32 1
346
343
%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 )
348
345
%cmp = icmp uge i32 %count.next , 1
349
346
br i1 %cmp , label %for.header , label %for.cond.cleanup
350
347
@@ -360,11 +357,12 @@ for.cond.cleanup:
360
357
}
361
358
362
359
; 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:
368
366
define void @check_loop_dec_uge_xor_brcond_combine (i32* nocapture %a , i32* nocapture readonly %b , i32* nocapture readonly %c , i32 %N ) {
369
367
entry:
370
368
%start = call i32 @llvm.start.loop.iterations.i32 (i32 %N )
@@ -387,7 +385,7 @@ for.body:
387
385
%scevgep2 = getelementptr i32 , i32* %lsr.iv1 , i32 1
388
386
%scevgep6 = getelementptr i32 , i32* %lsr.iv5 , i32 1
389
387
%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 )
391
389
%cmp = icmp uge i32 %count.next , 1
392
390
%negated = xor i1 %cmp , 1
393
391
br i1 %negated , label %for.cond.cleanup , label %for.header
@@ -404,11 +402,11 @@ for.cond.cleanup:
404
402
}
405
403
406
404
; 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
409
407
; CHECK-MID: bb.1.while.body.preheader:
410
408
; 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
412
410
; CHECk-MID: tB %bb.3
413
411
; CHECK-MID: bb.3.while.end:
414
412
define void @check_negated_xor_wls (i16* nocapture %a , i16* nocapture readonly %b , i32 %N ) {
@@ -428,7 +426,7 @@ while.body:
428
426
%ld.b = load i16 , i16* %b.addr.05 , align 2
429
427
%incdec.ptr1 = getelementptr inbounds i16 , i16* %a.addr.06 , i32 1
430
428
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 )
432
430
%cmp = icmp ne i32 %count.next , 0
433
431
br i1 %cmp , label %while.body , label %while.end
434
432
@@ -437,11 +435,11 @@ while.end:
437
435
}
438
436
439
437
; 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
442
440
; CHECK-MID: bb.1.while.body.preheader:
443
441
; 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
445
443
; CHECk-MID: tB %bb.3
446
444
; CHECK-MID: bb.3.while.end:
447
445
define void @check_negated_cmp_wls (i16* nocapture %a , i16* nocapture readonly %b , i32 %N ) {
@@ -461,7 +459,7 @@ while.body:
461
459
%ld.b = load i16 , i16* %b.addr.05 , align 2
462
460
%incdec.ptr1 = getelementptr inbounds i16 , i16* %a.addr.06 , i32 1
463
461
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 )
465
463
%cmp.1 = icmp ne i32 %count.next , 0
466
464
br i1 %cmp.1 , label %while.body , label %while.end
467
465
@@ -470,15 +468,13 @@ while.end:
470
468
}
471
469
472
470
; 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:
482
478
define void @check_negated_reordered_wls (i16* nocapture %a , i16* nocapture readonly %b , i32 %N ) {
483
479
entry:
484
480
br label %while
@@ -494,7 +490,7 @@ while.body:
494
490
%ld.b = load i16 , i16* %b.addr.05 , align 2
495
491
%incdec.ptr1 = getelementptr inbounds i16 , i16* %a.addr.06 , i32 1
496
492
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 )
498
494
%cmp = icmp ne i32 %count.next , 0
499
495
br i1 %cmp , label %while.body , label %while.end
500
496
@@ -509,4 +505,4 @@ while.end:
509
505
510
506
declare i32 @llvm.start.loop.iterations.i32 (i32 )
511
507
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