1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=arm-- -run-pass=prologepilog -run-pass=machine-outliner \
3 # RUN: -verify-machineinstrs %s -o - | FileCheck %s
6 define void @outline_call_arm() #0 { ret void }
7 define void @outline_call_thumb() #1 { ret void }
8 define void @outline_call_tailcall_arm() #0 { ret void }
9 define void @outline_call_tailcall_thumb() #1 { ret void }
10 define void @outline_call_KO_mcount() #0 { ret void }
11 define void @bar() #0 { ret void }
12 declare void @"\01mcount"()
14 attributes #0 = { minsize optsize }
15 attributes #1 = { minsize optsize "target-features"="+armv7-a,+thumb-mode" }
19 name: outline_call_arm
20 tracksRegLiveness: true
22 ; CHECK-LABEL: name: outline_call_arm
24 ; CHECK: liveins: $r4, $lr
25 ; CHECK: $sp = frame-setup STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r4, killed $lr
26 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
27 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4
28 ; CHECK: frame-setup CFI_INSTRUCTION offset $r4, -8
29 ; CHECK: BL @OUTLINED_FUNCTION_0
31 ; CHECK: BL @OUTLINED_FUNCTION_0
33 ; CHECK: BL @OUTLINED_FUNCTION_0
35 ; CHECK: BL @OUTLINED_FUNCTION_0
37 ; CHECK: BL @OUTLINED_FUNCTION_0
39 ; CHECK: $sp = frame-destroy LDMIA_UPD $sp, 14 /* CC::al */, $noreg, def $r4, def $lr
40 ; CHECK: BX_RET 14 /* CC::al */, $noreg
42 BL @bar, implicit-def dead $lr, implicit $sp
43 $r0 = MOVi 1, 14, $noreg, $noreg
44 $r1 = MOVi 1, 14, $noreg, $noreg
45 $r2 = MOVi 1, 14, $noreg, $noreg
46 $r3 = MOVi 1, 14, $noreg, $noreg
47 $r4 = MOVi 1, 14, $noreg, $noreg
49 BL @bar, implicit-def dead $lr, implicit $sp
50 $r0 = MOVi 1, 14, $noreg, $noreg
51 $r1 = MOVi 1, 14, $noreg, $noreg
52 $r2 = MOVi 1, 14, $noreg, $noreg
53 $r3 = MOVi 1, 14, $noreg, $noreg
54 $r4 = MOVi 1, 14, $noreg, $noreg
56 BL @bar, implicit-def dead $lr, implicit $sp
57 $r0 = MOVi 1, 14, $noreg, $noreg
58 $r1 = MOVi 1, 14, $noreg, $noreg
59 $r2 = MOVi 1, 14, $noreg, $noreg
60 $r3 = MOVi 1, 14, $noreg, $noreg
61 $r4 = MOVi 1, 14, $noreg, $noreg
63 BL @bar, implicit-def dead $lr, implicit $sp
64 $r0 = MOVi 1, 14, $noreg, $noreg
65 $r1 = MOVi 1, 14, $noreg, $noreg
66 $r2 = MOVi 1, 14, $noreg, $noreg
67 $r3 = MOVi 1, 14, $noreg, $noreg
68 $r4 = MOVi 1, 14, $noreg, $noreg
70 BL @bar, implicit-def dead $lr, implicit $sp
71 $r0 = MOVi 1, 14, $noreg, $noreg
72 $r1 = MOVi 1, 14, $noreg, $noreg
73 $r2 = MOVi 1, 14, $noreg, $noreg
74 $r3 = MOVi 1, 14, $noreg, $noreg
75 $r4 = MOVi 1, 14, $noreg, $noreg
81 name: outline_call_thumb
82 tracksRegLiveness: true
84 ; CHECK-LABEL: name: outline_call_thumb
86 ; CHECK: liveins: $r7, $lr
87 ; CHECK: $sp = frame-setup t2STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r7, killed $lr
88 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
89 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4
90 ; CHECK: frame-setup CFI_INSTRUCTION offset $r7, -8
91 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_4
93 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_4
95 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_4
97 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_4
99 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_4
101 ; CHECK: $sp = frame-destroy t2LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r7, def $pc
103 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
104 $r0 = t2MOVi 1, 14, $noreg, $noreg
105 $r1 = t2MOVi 1, 14, $noreg, $noreg
106 $r2 = t2MOVi 1, 14, $noreg, $noreg
108 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
109 $r0 = t2MOVi 1, 14, $noreg, $noreg
110 $r1 = t2MOVi 1, 14, $noreg, $noreg
111 $r2 = t2MOVi 1, 14, $noreg, $noreg
113 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
114 $r0 = t2MOVi 1, 14, $noreg, $noreg
115 $r1 = t2MOVi 1, 14, $noreg, $noreg
116 $r2 = t2MOVi 1, 14, $noreg, $noreg
118 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
119 $r0 = t2MOVi 1, 14, $noreg, $noreg
120 $r1 = t2MOVi 1, 14, $noreg, $noreg
121 $r2 = t2MOVi 1, 14, $noreg, $noreg
123 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
124 $r0 = t2MOVi 1, 14, $noreg, $noreg
125 $r1 = t2MOVi 1, 14, $noreg, $noreg
126 $r2 = t2MOVi 1, 14, $noreg, $noreg
132 name: outline_call_tailcall_arm
133 tracksRegLiveness: true
135 ; CHECK-LABEL: name: outline_call_tailcall_arm
137 ; CHECK: liveins: $r4, $lr
138 ; CHECK: $sp = frame-setup STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r4, killed $lr
139 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
140 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4
141 ; CHECK: frame-setup CFI_INSTRUCTION offset $r4, -8
142 ; CHECK: BL @OUTLINED_FUNCTION_1
144 ; CHECK: BL @OUTLINED_FUNCTION_1
146 ; CHECK: BL @OUTLINED_FUNCTION_1
148 ; CHECK: BL @OUTLINED_FUNCTION_1
150 ; CHECK: $sp = frame-destroy LDMIA_UPD $sp, 14 /* CC::al */, $noreg, def $r4, def $lr
151 ; CHECK: BX_RET 14 /* CC::al */, $noreg
153 BL @bar, implicit-def dead $lr, implicit $sp
154 $r0 = MOVi 2, 14, $noreg, $noreg
155 $r1 = MOVi 2, 14, $noreg, $noreg
156 $r2 = MOVi 2, 14, $noreg, $noreg
157 $r3 = MOVi 2, 14, $noreg, $noreg
158 $r4 = MOVi 2, 14, $noreg, $noreg
159 BL @bar, implicit-def dead $lr, implicit $sp
161 BL @bar, implicit-def dead $lr, implicit $sp
162 $r0 = MOVi 2, 14, $noreg, $noreg
163 $r1 = MOVi 2, 14, $noreg, $noreg
164 $r2 = MOVi 2, 14, $noreg, $noreg
165 $r3 = MOVi 2, 14, $noreg, $noreg
166 $r4 = MOVi 2, 14, $noreg, $noreg
167 BL @bar, implicit-def dead $lr, implicit $sp
169 BL @bar, implicit-def dead $lr, implicit $sp
170 $r0 = MOVi 2, 14, $noreg, $noreg
171 $r1 = MOVi 2, 14, $noreg, $noreg
172 $r2 = MOVi 2, 14, $noreg, $noreg
173 $r3 = MOVi 2, 14, $noreg, $noreg
174 $r4 = MOVi 2, 14, $noreg, $noreg
175 BL @bar, implicit-def dead $lr, implicit $sp
177 BL @bar, implicit-def dead $lr, implicit $sp
178 $r0 = MOVi 2, 14, $noreg, $noreg
179 $r1 = MOVi 2, 14, $noreg, $noreg
180 $r2 = MOVi 2, 14, $noreg, $noreg
181 $r3 = MOVi 2, 14, $noreg, $noreg
182 $r4 = MOVi 2, 14, $noreg, $noreg
183 BL @bar, implicit-def dead $lr, implicit $sp
189 name: outline_call_tailcall_thumb
190 tracksRegLiveness: true
192 ; CHECK-LABEL: name: outline_call_tailcall_thumb
194 ; CHECK: liveins: $r7, $lr
195 ; CHECK: $sp = frame-setup t2STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r7, killed $lr
196 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
197 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4
198 ; CHECK: frame-setup CFI_INSTRUCTION offset $r7, -8
199 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3
201 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3
203 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3
205 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3
207 ; CHECK: $sp = frame-destroy t2LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r7, def $pc
209 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
210 $r0 = t2MOVi 2, 14, $noreg, $noreg
211 $r1 = t2MOVi 2, 14, $noreg, $noreg
212 $r2 = t2MOVi 2, 14, $noreg, $noreg
213 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
215 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
216 $r0 = t2MOVi 2, 14, $noreg, $noreg
217 $r1 = t2MOVi 2, 14, $noreg, $noreg
218 $r2 = t2MOVi 2, 14, $noreg, $noreg
219 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
221 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
222 $r0 = t2MOVi 2, 14, $noreg, $noreg
223 $r1 = t2MOVi 2, 14, $noreg, $noreg
224 $r2 = t2MOVi 2, 14, $noreg, $noreg
225 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
227 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
228 $r0 = t2MOVi 2, 14, $noreg, $noreg
229 $r1 = t2MOVi 2, 14, $noreg, $noreg
230 $r2 = t2MOVi 2, 14, $noreg, $noreg
231 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp
237 name: outline_call_KO_mcount
238 tracksRegLiveness: true
240 ; CHECK-LABEL: name: outline_call_KO_mcount
242 ; CHECK: liveins: $r4, $lr
243 ; CHECK: $sp = frame-setup STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r4, killed $lr
244 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
245 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4
246 ; CHECK: frame-setup CFI_INSTRUCTION offset $r4, -8
247 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
248 ; CHECK: BL @OUTLINED_FUNCTION_2
250 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
251 ; CHECK: BL @OUTLINED_FUNCTION_2
253 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
254 ; CHECK: BL @OUTLINED_FUNCTION_2
256 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
257 ; CHECK: BL @OUTLINED_FUNCTION_2
259 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
260 ; CHECK: BL @OUTLINED_FUNCTION_2
262 ; CHECK: $sp = frame-destroy LDMIA_UPD $sp, 14 /* CC::al */, $noreg, def $r4, def $lr
263 ; CHECK: BX_RET 14 /* CC::al */, $noreg
265 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
266 $r0 = MOVi 3, 14, $noreg, $noreg
267 $r1 = MOVi 3, 14, $noreg, $noreg
268 $r2 = MOVi 3, 14, $noreg, $noreg
269 $r3 = MOVi 3, 14, $noreg, $noreg
270 $r4 = MOVi 3, 14, $noreg, $noreg
272 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
273 $r0 = MOVi 3, 14, $noreg, $noreg
274 $r1 = MOVi 3, 14, $noreg, $noreg
275 $r2 = MOVi 3, 14, $noreg, $noreg
276 $r3 = MOVi 3, 14, $noreg, $noreg
277 $r4 = MOVi 3, 14, $noreg, $noreg
279 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
280 $r0 = MOVi 3, 14, $noreg, $noreg
281 $r1 = MOVi 3, 14, $noreg, $noreg
282 $r2 = MOVi 3, 14, $noreg, $noreg
283 $r3 = MOVi 3, 14, $noreg, $noreg
284 $r4 = MOVi 3, 14, $noreg, $noreg
286 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
287 $r0 = MOVi 3, 14, $noreg, $noreg
288 $r1 = MOVi 3, 14, $noreg, $noreg
289 $r2 = MOVi 3, 14, $noreg, $noreg
290 $r3 = MOVi 3, 14, $noreg, $noreg
291 $r4 = MOVi 3, 14, $noreg, $noreg
293 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp
294 $r0 = MOVi 3, 14, $noreg, $noreg
295 $r1 = MOVi 3, 14, $noreg, $noreg
296 $r2 = MOVi 3, 14, $noreg, $noreg
297 $r3 = MOVi 3, 14, $noreg, $noreg
298 $r4 = MOVi 3, 14, $noreg, $noreg
305 tracksRegLiveness: true
311 ; CHECK-LABEL: name: OUTLINED_FUNCTION_0
313 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r7, $r6, $r5, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8, $lr
314 ; CHECK: early-clobber $sp = frame-setup STR_PRE_IMM killed $lr, $sp, -8, 14 /* CC::al */, $noreg
315 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
316 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -8
317 ; CHECK: BL @bar, implicit-def dead $lr, implicit $sp
318 ; CHECK: $r0 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
319 ; CHECK: $r1 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
320 ; CHECK: $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
321 ; CHECK: $r3 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
322 ; CHECK: $r4 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
323 ; CHECK: $lr, $sp = frame-destroy LDR_POST_IMM $sp, $noreg, 8, 14 /* CC::al */, $noreg
324 ; CHECK: MOVPCLR 14 /* CC::al */, $noreg
326 ; CHECK-LABEL: name: OUTLINED_FUNCTION_1
328 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r7, $r6, $r5, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8, $lr
329 ; CHECK: early-clobber $sp = frame-setup STR_PRE_IMM killed $lr, $sp, -8, 14 /* CC::al */, $noreg
330 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
331 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -8
332 ; CHECK: BL @bar, implicit-def dead $lr, implicit $sp
333 ; CHECK: $r0 = MOVi 2, 14 /* CC::al */, $noreg, $noreg
334 ; CHECK: $r1 = MOVi 2, 14 /* CC::al */, $noreg, $noreg
335 ; CHECK: $r2 = MOVi 2, 14 /* CC::al */, $noreg, $noreg
336 ; CHECK: $r3 = MOVi 2, 14 /* CC::al */, $noreg, $noreg
337 ; CHECK: $r4 = MOVi 2, 14 /* CC::al */, $noreg, $noreg
338 ; CHECK: $lr, $sp = frame-destroy LDR_POST_IMM $sp, $noreg, 8, 14 /* CC::al */, $noreg
339 ; CHECK: TAILJMPd @bar, implicit $sp
341 ; CHECK-LABEL: name: OUTLINED_FUNCTION_2
343 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r7, $r6, $r5, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8
344 ; CHECK: $r0 = MOVi 3, 14 /* CC::al */, $noreg, $noreg
345 ; CHECK: $r1 = MOVi 3, 14 /* CC::al */, $noreg, $noreg
346 ; CHECK: $r2 = MOVi 3, 14 /* CC::al */, $noreg, $noreg
347 ; CHECK: $r3 = MOVi 3, 14 /* CC::al */, $noreg, $noreg
348 ; CHECK: $r4 = MOVi 3, 14 /* CC::al */, $noreg, $noreg
349 ; CHECK: MOVPCLR 14 /* CC::al */, $noreg
351 ; CHECK-LABEL: name: OUTLINED_FUNCTION_3
353 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r6, $r5, $r4, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8, $lr
354 ; CHECK: early-clobber $sp = frame-setup t2STR_PRE killed $lr, $sp, -8, 14 /* CC::al */, $noreg
355 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
356 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -8
357 ; CHECK: tBL 14 /* CC::al */, $noreg, @bar, implicit-def dead $lr, implicit $sp
358 ; CHECK: $r0 = t2MOVi 2, 14 /* CC::al */, $noreg, $noreg
359 ; CHECK: $r1 = t2MOVi 2, 14 /* CC::al */, $noreg, $noreg
360 ; CHECK: $r2 = t2MOVi 2, 14 /* CC::al */, $noreg, $noreg
361 ; CHECK: $lr, $sp = frame-destroy t2LDR_POST $sp, 8, 14 /* CC::al */, $noreg
362 ; CHECK: tTAILJMPdND @bar, 14 /* CC::al */, $noreg, implicit $sp
364 ; CHECK-LABEL: name: OUTLINED_FUNCTION_4
366 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r6, $r5, $r4, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8, $lr
367 ; CHECK: early-clobber $sp = frame-setup t2STR_PRE killed $lr, $sp, -8, 14 /* CC::al */, $noreg
368 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
369 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -8
370 ; CHECK: tBL 14 /* CC::al */, $noreg, @bar, implicit-def dead $lr, implicit $sp
371 ; CHECK: $r0 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
372 ; CHECK: $r1 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
373 ; CHECK: $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg
374 ; CHECK: $lr, $sp = frame-destroy t2LDR_POST $sp, 8, 14 /* CC::al */, $noreg
375 ; CHECK: tBX_RET 14 /* CC::al */, $noreg