1 # RUN: llc -verify-machineinstrs -run-pass=machine-outliner %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 PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
71 frame-setup CFI_INSTRUCTION negate_ra_sign_state
72 $sp = frame-setup SUBXri $sp, 16, 0
73 renamable $x8 = ADRP target-flags(aarch64-page) @v
74 $x9 = ADDXri $sp, 12, 0
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 renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
81 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
82 $sp = frame-destroy ADDXri $sp, 16, 0
83 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
84 frame-destroy CFI_INSTRUCTION negate_ra_sign_state
87 # CHECK-LABEL: name: legal0
89 # CHECK-NEXT: bb.0 (%ir-block.0):
90 # CHECK-NEXT: liveins: $lr
91 # CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
92 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
93 # CHECK: BL @[[OUTLINED_FUNC:OUTLINED_FUNCTION_[0-9]+]]
94 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
95 # CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
96 # CHECK-NEXT: RET undef $lr
101 tracksRegLiveness: true
105 frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
106 frame-setup CFI_INSTRUCTION negate_ra_sign_state
107 $sp = frame-setup SUBXri $sp, 16, 0
108 renamable $x8 = ADRP target-flags(aarch64-page) @v
109 $x9 = ADDXri $sp, 12, 0
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 renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
114 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
115 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
116 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
117 $sp = frame-destroy ADDXri $sp, 16, 0
118 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
119 frame-destroy CFI_INSTRUCTION negate_ra_sign_state
122 # CHECK-LABEL: name: legal1
124 # CHECK-NEXT: bb.0 (%ir-block.0):
125 # CHECK-NEXT: liveins: $lr
126 # CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
127 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
128 # CHECK: BL @[[OUTLINED_FUNC]]
129 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
130 # CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
131 # CHECK-NEXT: RET undef $lr
136 tracksRegLiveness: true
140 frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
141 frame-setup CFI_INSTRUCTION negate_ra_sign_state
142 $sp = frame-setup SUBXri $sp, 16, 0
143 renamable $x8 = ADRP target-flags(aarch64-page) @v
144 $x9 = ADDXri $sp, 12, 0
145 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
146 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
147 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
148 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
149 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
150 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
151 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
152 $sp = frame-destroy ADDXri $sp, 12, 0
153 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
154 frame-destroy CFI_INSTRUCTION negate_ra_sign_state
160 tracksRegLiveness: true
164 frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
165 frame-setup CFI_INSTRUCTION negate_ra_sign_state
166 $sp = frame-setup SUBXri $sp, 16, 0
167 renamable $x8 = ADRP target-flags(aarch64-page) @v
168 $x9 = ADDXri $sp, 12, 0
169 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
170 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
171 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
172 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
173 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
174 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
175 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
176 $sp = frame-destroy ADDXri $sp, 12, 0
177 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
178 frame-destroy CFI_INSTRUCTION negate_ra_sign_state
181 # CHECK-LABEL: name: illegal0
183 # CHECK-NEXT: bb.0 (%ir-block.0):
184 # CHECK-NEXT: liveins: $lr
185 # CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
186 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
187 # CHECK-NOT: BL @OUTLINED_FUNCTION_{{.*}}
188 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
189 # CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
190 # CHECK-NEXT: RET undef $lr
192 # CHECK-LABEL: name: illegal1
194 # CHECK-NEXT: bb.0 (%ir-block.0):
195 # CHECK-NEXT: liveins: $lr
196 # CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
197 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
198 # CHECK-NOT: BL @OUTLINED_FUNCTION_{{.*}}
199 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
200 # CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
201 # CHECK-NEXT: RET undef $lr
203 # Outlined function that contains only legal sp modifications
204 # CHECK: name: [[OUTLINED_FUNC]]
207 # CHECK-NEXT: liveins: $lr
208 # CHECK-NEXT: {{^ $}}
209 # CHECK-NEXT: frame-setup PACIASP implicit-def $lr, implicit $lr, implicit $sp
210 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
211 # CHECK-NEXT: $sp = frame-setup SUBXri $sp, 16, 0
212 # CHECK: $sp = frame-destroy ADDXri $sp, 16, 0
213 # CHECK-NEXT: frame-destroy AUTIASP implicit-def $lr, implicit $lr, implicit $sp
214 # CHECK-NEXT: RET $lr