Skip to content

Commit 5f99333

Browse files
committed
Add test showing bug
1 parent 68d90cf commit 5f99333

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
2+
# RUN: llc -mtriple aarch64-none-elf -run-pass=block-placement -O3 -o - %s | FileCheck %s
3+
4+
## Check that block-placement does not perform tail duplication on the
5+
## PAUTH_EPILOGUE instruction. If that happened, the two prologues would use
6+
## different addresses while calculating the return address signature, so the
7+
## epilogue could only be correct for (at most) one of them.
8+
9+
--- |
10+
define void @test() "frame-pointer"="non-leaf" {
11+
entry:
12+
ret void
13+
}
14+
15+
declare void @f()
16+
...
17+
---
18+
name: test
19+
body: |
20+
; CHECK-LABEL: name: test
21+
; CHECK: bb.0.entry:
22+
; CHECK-NEXT: successors: %bb.1(0x30000000), %bb.2(0x50000000)
23+
; CHECK-NEXT: liveins: $w0, $w1, $lr
24+
; CHECK-NEXT: {{ $}}
25+
; CHECK-NEXT: CBZW renamable $w0, %bb.1
26+
; CHECK-NEXT: {{ $}}
27+
; CHECK-NEXT: bb.2:
28+
; CHECK-NEXT: successors: %bb.5(0x30000000), %bb.4(0x50000000)
29+
; CHECK-NEXT: liveins: $w0, $w1, $lr
30+
; CHECK-NEXT: {{ $}}
31+
; CHECK-NEXT: frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit killed $lr, implicit $sp
32+
; CHECK-NEXT: CBZW killed renamable $w1, %bb.5
33+
; CHECK-NEXT: {{ $}}
34+
; CHECK-NEXT: bb.4:
35+
; CHECK-NEXT: successors: %bb.5(0x80000000)
36+
; CHECK-NEXT: {{ $}}
37+
; CHECK-NEXT: BL @f, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
38+
; CHECK-NEXT: {{ $}}
39+
; CHECK-NEXT: bb.5:
40+
; CHECK-NEXT: BL @f, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
41+
; CHECK-NEXT: frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit killed $lr, implicit $sp
42+
; CHECK-NEXT: TCRETURNdi @f, 0, csr_aarch64_aapcs, implicit $sp
43+
; CHECK-NEXT: {{ $}}
44+
; CHECK-NEXT: bb.1:
45+
; CHECK-NEXT: successors: %bb.5(0x30000000), %bb.4(0x50000000)
46+
; CHECK-NEXT: liveins: $w1, $lr
47+
; CHECK-NEXT: {{ $}}
48+
; CHECK-NEXT: renamable $w8 = MOVZWi 1, 0
49+
; CHECK-NEXT: frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit killed $lr, implicit $sp
50+
; CHECK-NEXT: CBNZW killed renamable $w1, %bb.4
51+
; CHECK-NEXT: B %bb.5
52+
bb.0.entry:
53+
successors: %bb.1(0x30000000), %bb.2(0x50000000)
54+
liveins: $w0, $w1, $lr
55+
56+
CBNZW renamable $w0, %bb.2
57+
58+
bb.1:
59+
successors: %bb.3(0x80000000)
60+
liveins: $w1, $lr
61+
62+
renamable $w8 = MOVZWi 1, 0
63+
B %bb.3
64+
65+
bb.2:
66+
successors: %bb.3(0x80000000)
67+
liveins: $w0, $w1, $lr
68+
69+
bb.3:
70+
successors: %bb.5(0x30000000), %bb.4(0x50000000)
71+
liveins: $w1, $w8, $lr
72+
73+
frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit killed $lr, implicit $sp
74+
CBZW killed renamable $w1, %bb.5
75+
76+
bb.4:
77+
successors: %bb.5(0x80000000)
78+
79+
BL @f, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
80+
81+
bb.5:
82+
BL @f, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
83+
frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit killed $lr, implicit $sp
84+
TCRETURNdi @f, 0, csr_aarch64_aapcs, implicit $sp
85+
...

0 commit comments

Comments
 (0)