1 # RUN: llc -verify-machineinstrs -run-pass=machine-outliner -run-pass=aarch64-ptrauth %s -o - | FileCheck %s
4 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
5 target triple = "aarch64-arm-linux-gnu"
7 @v = common dso_local global i32* null, align 8
9 ; Function Attrs: nounwind
10 define dso_local void @legal0() #0 {
11 %1 = alloca i32, align 4
12 store volatile i32* %1, i32** @v, align 8
13 store volatile i32* %1, i32** @v, align 8
14 store volatile i32* %1, i32** @v, align 8
15 store volatile i32* %1, i32** @v, align 8
16 store volatile i32* %1, i32** @v, align 8
17 store volatile i32* %1, i32** @v, align 8
18 store volatile i32* %1, i32** @v, align 8
22 ; Function Attrs: nounwind
23 define dso_local void @legal1() #0 {
24 %1 = alloca i32, align 4
25 store volatile i32* %1, i32** @v, align 8
26 store volatile i32* %1, i32** @v, align 8
27 store volatile i32* %1, i32** @v, align 8
28 store volatile i32* %1, i32** @v, align 8
29 store volatile i32* %1, i32** @v, align 8
30 store volatile i32* %1, i32** @v, align 8
31 store volatile i32* %1, i32** @v, align 8
35 ; Function Attrs: nounwind
36 define dso_local void @illegal0() #0 {
37 %1 = alloca i32, align 4
38 store volatile i32* %1, i32** @v, align 8
39 store volatile i32* %1, i32** @v, align 8
40 store volatile i32* %1, i32** @v, align 8
41 store volatile i32* %1, i32** @v, align 8
42 store volatile i32* %1, i32** @v, align 8
43 store volatile i32* %1, i32** @v, align 8
44 store volatile i32* %1, i32** @v, align 8
48 ; Function Attrs: nounwind
49 define dso_local void @illegal1() #0 {
50 %1 = alloca i32, align 4
51 store volatile i32* %1, i32** @v, align 8
52 store volatile i32* %1, i32** @v, align 8
53 store volatile i32* %1, i32** @v, align 8
54 store volatile i32* %1, i32** @v, align 8
55 store volatile i32* %1, i32** @v, align 8
56 store volatile i32* %1, i32** @v, align 8
57 store volatile i32* %1, i32** @v, align 8
61 attributes #0 = { nounwind uwtable "sign-return-address"="all" "sign-return-address-key"="a_key" noinline noredzone "frame-pointer"="all" }
66 tracksRegLiveness: true
70 frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit $lr, implicit $sp
71 $sp = frame-setup SUBXri $sp, 16, 0
72 renamable $x8 = ADRP target-flags(aarch64-page) @v
73 $x9 = ADDXri $sp, 12, 0
74 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
75 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
76 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
77 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
78 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
79 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
80 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
81 $sp = frame-destroy ADDXri $sp, 16, 0
82 frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit $lr, implicit $sp
85 # CHECK-LABEL: name: legal0
87 # CHECK-NEXT: bb.0 (%ir-block.0):
88 # CHECK-NEXT: liveins: $lr
89 # CHECK: frame-setup PACIASP implicit-def $lr, implicit $lr, implicit $sp
90 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
91 # CHECK: BL @[[OUTLINED_FUNC:OUTLINED_FUNCTION_[0-9]+]]
92 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit $lr, implicit $sp
93 # CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
94 # CHECK-NEXT: RET undef $lr
99 tracksRegLiveness: true
103 frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit $lr, implicit $sp
104 $sp = frame-setup SUBXri $sp, 16, 0
105 renamable $x8 = ADRP target-flags(aarch64-page) @v
106 $x9 = ADDXri $sp, 12, 0
107 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
108 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
109 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
110 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
111 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
112 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
113 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
114 $sp = frame-destroy ADDXri $sp, 16, 0
115 frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit $lr, implicit $sp
118 # CHECK-LABEL: name: legal1
120 # CHECK-NEXT: bb.0 (%ir-block.0):
121 # CHECK-NEXT: liveins: $lr
122 # CHECK: frame-setup PACIASP implicit-def $lr, implicit $lr, implicit $sp
123 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
124 # CHECK: BL @[[OUTLINED_FUNC]]
125 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit $lr, implicit $sp
126 # CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
127 # CHECK-NEXT: RET undef $lr
132 tracksRegLiveness: true
136 frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit $lr, implicit $sp
137 $sp = frame-setup SUBXri $sp, 16, 0
138 renamable $x8 = ADRP target-flags(aarch64-page) @v
139 $x9 = ADDXri $sp, 12, 0
140 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
141 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
142 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
143 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
144 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
145 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
146 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
147 $sp = frame-destroy ADDXri $sp, 12, 0
148 frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit $lr, implicit $sp
154 tracksRegLiveness: true
158 frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit $lr, implicit $sp
159 $sp = frame-setup SUBXri $sp, 16, 0
160 renamable $x8 = ADRP target-flags(aarch64-page) @v
161 $x9 = ADDXri $sp, 12, 0
162 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
163 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
164 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
165 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
166 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
167 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
168 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
169 $sp = frame-destroy ADDXri $sp, 12, 0
170 frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit $lr, implicit $sp
173 # CHECK-LABEL: name: illegal0
175 # CHECK-NEXT: bb.0 (%ir-block.0):
176 # CHECK-NEXT: liveins: $lr
177 # CHECK: frame-setup PACIASP implicit-def $lr, implicit $lr, implicit $sp
178 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
179 # CHECK-NOT: BL @OUTLINED_FUNCTION_{{.*}}
180 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit $lr, implicit $sp
181 # CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
182 # CHECK-NEXT: RET undef $lr
184 # CHECK-LABEL: name: illegal1
186 # CHECK-NEXT: bb.0 (%ir-block.0):
187 # CHECK-NEXT: liveins: $lr
188 # CHECK: frame-setup PACIASP implicit-def $lr, implicit $lr, implicit $sp
189 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
190 # CHECK-NOT: BL @OUTLINED_FUNCTION_{{.*}}
191 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit $lr, implicit $sp
192 # CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
193 # CHECK-NEXT: RET undef $lr
195 # Outlined function that contains only legal sp modifications
196 # CHECK: name: [[OUTLINED_FUNC]]
199 # CHECK-NEXT: liveins: $lr
200 # CHECK-NEXT: {{^ $}}
201 # CHECK-NEXT: frame-setup PACIASP implicit-def $lr, implicit $lr, implicit $sp
202 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
203 # CHECK-NEXT: $sp = frame-setup SUBXri $sp, 16, 0
204 # CHECK: $sp = frame-destroy ADDXri $sp, 16, 0
205 # CHECK-NEXT: frame-destroy AUTIASP implicit-def $lr, implicit $lr, implicit $sp
206 # CHECK-NEXT: RET $lr