1 # RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner \
2 # RUN: -verify-machineinstrs %s -o - | FileCheck %s
4 # Ensure that we don't outline from regions where x16, x17, or nzcv are live
5 # across the outlining candidate. These values are allowed to be clobbered by,
6 # say, the linker, in the presence of function calls. Thus, we can't outline
7 # these, since the insertion of the outlined call could change the values of
10 ; No problematic register appears at all. Safe for outlining.
11 define void @reg_never_defined() #0 { ret void }
13 ; A problematic register is live, but after the candidate. Safe for outlining.
14 define void @reg_defined_after_candidate() #0 { ret void }
16 ; A problematic register is live before the candidate, but killed before
17 ; entry to the candidate. Safe for outlining.
18 define void @reg_killed_before_candidate() #0 { ret void }
20 ; Ensure that we never outline when any of the problematic registers we care
21 ; about are defined across the outlining candidate.
22 define void @x16_live() #0 { ret void }
23 define void @x17_live() #0 { ret void }
24 define void @nzcv_live() #0 { ret void }
26 ; Test a combination of the above behaviours.
28 ; - define a bad register -
30 ; - kill the bad register -
33 ; (1) and (3) should be outlined, while (2) should not be outlined.
34 define void @multiple_ranges() #0 { ret void }
36 attributes #0 = { noredzone }
40 # There should be two calls to outlined functions here, since we haven't tripped
41 # any of the cases above.
42 name: reg_never_defined
43 tracksRegLiveness: true
66 name: reg_defined_after_candidate
67 tracksRegLiveness: true
72 ; CHECK-NEXT: $x16 = ORRXri $x8, 5, implicit-def $x16, implicit-def $w16
78 $x16 = ORRXri $x8, 5, implicit-def $x16, implicit-def $w16
84 name: reg_killed_before_candidate
85 tracksRegLiveness: true
90 liveins: $w8, $wzr, $x16
91 dead $x16 = ORRXri $x8, 6
101 tracksRegLiveness: true
106 liveins: $w8, $wzr, $x16
118 tracksRegLiveness: true
123 liveins: $w8, $wzr, $x17
134 tracksRegLiveness: true
137 liveins: $w8, $wzr, $nzcv
150 name: multiple_ranges
151 tracksRegLiveness: true
161 $x16 = ORRXri $x8, 5, implicit-def $x16
174 dead $x16 = ORRXri $x8, 0