1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=aarch64-apple-unknown -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s
3
4# Outlining CFI instructions is unsafe if it is not tail called, but otherwise,
5# it requires fixups. Show that we include CFI instructions in tail call
6# outlined sequences right now.
7
8--- |
9  define void @foo() #0 { ret void }
10  define void @bar() #0 { ret void }
11  define void @baz() #0 { ret void }
12  attributes #0 = { noredzone }
13...
14---
15name:            foo
16tracksRegLiveness: true
17body:             |
18  bb.0:
19  liveins: $lr
20    ; CHECK-LABEL: name: foo
21    ; CHECK: liveins: $lr
22    ; CHECK: TCRETURNdi @OUTLINED_FUNCTION_0, 0, implicit $sp, implicit-def $w9, implicit-def $w10, implicit-def $w11, implicit-def $w12, implicit-def $w13, implicit-def $w14, implicit-def $w15, implicit $wzr, implicit $sp
23    $w9 = ORRWri $wzr, 1
24    $w10 = ORRWri $wzr, 2
25    $w11 = ORRWri $wzr, 3
26    frame-setup CFI_INSTRUCTION def_cfa $w29, 16
27    $w12 = ORRWri $wzr, 1
28    $w13 = ORRWri $wzr, 2
29    $w14 = ORRWri $wzr, 3
30    $w15 = ORRWri $wzr, 4
31    RET undef $lr
32...
33---
34name:            bar
35tracksRegLiveness: true
36body:             |
37  bb.0:
38  liveins: $lr
39    ; CHECK-LABEL: name: bar
40    ; CHECK: liveins: $lr
41    ; CHECK: TCRETURNdi @OUTLINED_FUNCTION_0, 0, implicit $sp, implicit-def $w9, implicit-def $w10, implicit-def $w11, implicit-def $w12, implicit-def $w13, implicit-def $w14, implicit-def $w15, implicit $wzr, implicit $sp
42    $w9 = ORRWri $wzr, 1
43    $w10 = ORRWri $wzr, 2
44    $w11 = ORRWri $wzr, 3
45    frame-setup CFI_INSTRUCTION def_cfa $w29, 16
46    $w12 = ORRWri $wzr, 1
47    $w13 = ORRWri $wzr, 2
48    $w14 = ORRWri $wzr, 3
49    $w15 = ORRWri $wzr, 4
50    RET undef $lr
51...
52---
53name:            baz
54tracksRegLiveness: true
55body:             |
56  bb.0:
57  liveins: $lr
58    ; CHECK-LABEL: name: baz
59    ; CHECK: liveins: $lr
60    ; CHECK: TCRETURNdi @OUTLINED_FUNCTION_0, 0, implicit $sp, implicit-def $w9, implicit-def $w10, implicit-def $w11, implicit-def $w12, implicit-def $w13, implicit-def $w14, implicit-def $w15, implicit $wzr, implicit $sp
61    $w9 = ORRWri $wzr, 1
62    $w10 = ORRWri $wzr, 2
63    $w11 = ORRWri $wzr, 3
64    frame-setup CFI_INSTRUCTION def_cfa $w29, 16
65    $w12 = ORRWri $wzr, 1
66    $w13 = ORRWri $wzr, 2
67    $w14 = ORRWri $wzr, 3
68    $w15 = ORRWri $wzr, 4
69    RET undef $lr
70