machine-outliner-retaddr-sign-sp-mod.mir
9.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# RUN: llc -verify-machineinstrs -run-pass=machine-outliner %s -o - | FileCheck %s
--- |
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-arm-linux-gnu"
@v = common dso_local global i32* null, align 8
; Function Attrs: nounwind
define dso_local void @legal0() #0 {
%1 = alloca i32, align 4
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
ret void
}
; Function Attrs: nounwind
define dso_local void @legal1() #0 {
%1 = alloca i32, align 4
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
ret void
}
; Function Attrs: nounwind
define dso_local void @illegal0() #0 {
%1 = alloca i32, align 4
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
ret void
}
; Function Attrs: nounwind
define dso_local void @illegal1() #0 {
%1 = alloca i32, align 4
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
store volatile i32* %1, i32** @v, align 8
ret void
}
attributes #0 = { nounwind "sign-return-address"="all" "sign-return-address-key"="a_key" noinline noredzone "frame-pointer"="all" }
...
---
name: legal0
tracksRegLiveness: true
body: |
bb.0 (%ir-block.0):
liveins: $lr
frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
frame-setup CFI_INSTRUCTION negate_ra_sign_state
$sp = frame-setup SUBXri $sp, 16, 0
renamable $x8 = ADRP target-flags(aarch64-page) @v
$x9 = ADDXri $sp, 12, 0
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
$sp = frame-destroy ADDXri $sp, 16, 0
frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
RET undef $lr
# CHECK-LABEL: name: legal0
# CHECK: body: |
# CHECK-NEXT: bb.0 (%ir-block.0):
# CHECK-NEXT: liveins: $lr
# CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
# CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
# CHECK: BL @[[OUTLINED_FUNC:OUTLINED_FUNCTION_[0-9]+]]
# CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
# CHECK-NEXT: RET undef $lr
...
---
name: legal1
tracksRegLiveness: true
body: |
bb.0 (%ir-block.0):
liveins: $lr
frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
frame-setup CFI_INSTRUCTION negate_ra_sign_state
$sp = frame-setup SUBXri $sp, 16, 0
renamable $x8 = ADRP target-flags(aarch64-page) @v
$x9 = ADDXri $sp, 12, 0
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
$sp = frame-destroy ADDXri $sp, 16, 0
frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
RET undef $lr
# CHECK-LABEL: name: legal1
# CHECK: body: |
# CHECK-NEXT: bb.0 (%ir-block.0):
# CHECK-NEXT: liveins: $lr
# CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
# CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
# CHECK: BL @[[OUTLINED_FUNC]]
# CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
# CHECK-NEXT: RET undef $lr
...
---
name: illegal0
tracksRegLiveness: true
body: |
bb.0 (%ir-block.0):
liveins: $lr
frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
frame-setup CFI_INSTRUCTION negate_ra_sign_state
$sp = frame-setup SUBXri $sp, 16, 0
renamable $x8 = ADRP target-flags(aarch64-page) @v
$x9 = ADDXri $sp, 12, 0
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
$sp = frame-destroy ADDXri $sp, 12, 0
frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
RET undef $lr
...
---
name: illegal1
tracksRegLiveness: true
body: |
bb.0 (%ir-block.0):
liveins: $lr
frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
frame-setup CFI_INSTRUCTION negate_ra_sign_state
$sp = frame-setup SUBXri $sp, 16, 0
renamable $x8 = ADRP target-flags(aarch64-page) @v
$x9 = ADDXri $sp, 12, 0
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store 8 into @v)
$sp = frame-destroy ADDXri $sp, 12, 0
frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
RET undef $lr
# CHECK-LABEL: name: illegal0
# CHECK: body: |
# CHECK-NEXT: bb.0 (%ir-block.0):
# CHECK-NEXT: liveins: $lr
# CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
# CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
# CHECK-NOT: BL @OUTLINED_FUNCTION_{{.*}}
# CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
# CHECK-NEXT: RET undef $lr
# CHECK-LABEL: name: illegal1
# CHECK: body: |
# CHECK-NEXT: bb.0 (%ir-block.0):
# CHECK-NEXT: liveins: $lr
# CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
# CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
# CHECK-NOT: BL @OUTLINED_FUNCTION_{{.*}}
# CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
# CHECK-NEXT: RET undef $lr
# Outlined function that contains only legal sp modifications
# CHECK: name: [[OUTLINED_FUNC]]
# CHECK: body: |
# CHECK-NEXT: bb.0:
# CHECK-NEXT: frame-setup PACIASP implicit-def $lr, implicit $lr, implicit $sp
# CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
# CHECK-NEXT: $sp = frame-setup SUBXri $sp, 16, 0
# CHECK: $sp = frame-destroy ADDXri $sp, 16, 0
# CHECK-NEXT: frame-destroy AUTIASP implicit-def $lr, implicit $lr, implicit $sp
# CHECK-NEXT: RET undef $lr