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 "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
86 # CHECK-LABEL: name: legal0
88 # CHECK-NEXT: bb.0 (%ir-block.0):
89 # CHECK-NEXT: liveins: $lr
90 # CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
91 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
92 # CHECK: BL @[[OUTLINED_FUNC:OUTLINED_FUNCTION_[0-9]+]]
93 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
94 # CHECK-NEXT: RET undef $lr
99 tracksRegLiveness: true
103 frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
104 frame-setup CFI_INSTRUCTION negate_ra_sign_state
105 $sp = frame-setup SUBXri $sp, 16, 0
106 renamable $x8 = ADRP target-flags(aarch64-page) @v
107 $x9 = ADDXri $sp, 12, 0
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 renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
114 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
115 $sp = frame-destroy ADDXri $sp, 16, 0
116 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
119 # CHECK-LABEL: name: legal1
121 # CHECK-NEXT: bb.0 (%ir-block.0):
122 # CHECK-NEXT: liveins: $lr
123 # CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
124 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
125 # CHECK: BL @[[OUTLINED_FUNC]]
126 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
127 # CHECK-NEXT: RET undef $lr
132 tracksRegLiveness: true
136 frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
137 frame-setup CFI_INSTRUCTION negate_ra_sign_state
138 $sp = frame-setup SUBXri $sp, 16, 0
139 renamable $x8 = ADRP target-flags(aarch64-page) @v
140 $x9 = ADDXri $sp, 12, 0
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 renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
147 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
148 $sp = frame-destroy ADDXri $sp, 12, 0
149 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
155 tracksRegLiveness: true
159 frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
160 frame-setup CFI_INSTRUCTION negate_ra_sign_state
161 $sp = frame-setup SUBXri $sp, 16, 0
162 renamable $x8 = ADRP target-flags(aarch64-page) @v
163 $x9 = ADDXri $sp, 12, 0
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 renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
169 STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
170 STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
171 $sp = frame-destroy ADDXri $sp, 12, 0
172 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
175 # CHECK-LABEL: name: illegal0
177 # CHECK-NEXT: bb.0 (%ir-block.0):
178 # CHECK-NEXT: liveins: $lr
179 # CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
180 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
181 # CHECK-NOT: BL @OUTLINED_FUNCTION_{{.*}}
182 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
183 # CHECK-NEXT: RET undef $lr
185 # CHECK-LABEL: name: illegal1
187 # CHECK-NEXT: bb.0 (%ir-block.0):
188 # CHECK-NEXT: liveins: $lr
189 # CHECK: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
190 # CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
191 # CHECK-NOT: BL @OUTLINED_FUNCTION_{{.*}}
192 # CHECK: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
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