184 lines · plain
1# RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner \2# RUN: -verify-machineinstrs %s -o - | FileCheck %s3 4# Ensure that we don't outline from regions where x16, x17, or nzcv are live5# 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 outline7# these, since the insertion of the outlined call could change the values of8# these registers.9--- |10 ; No problematic register appears at all. Safe for outlining.11 define void @reg_never_defined() #0 { ret void }12 13 ; A problematic register is live, but after the candidate. Safe for outlining.14 define void @reg_defined_after_candidate() #0 { ret void }15 16 ; A problematic register is live before the candidate, but killed before17 ; entry to the candidate. Safe for outlining.18 define void @reg_killed_before_candidate() #0 { ret void }19 20 ; Ensure that we never outline when any of the problematic registers we care21 ; 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 }25 26 ; Test a combination of the above behaviours.27 ; [candidate] (1)28 ; - define a bad register -29 ; [candidate] (2)30 ; - kill the bad register -31 ; [candidate] (3)32 ;33 ; (1) and (3) should be outlined, while (2) should not be outlined.34 define void @multiple_ranges() #0 { ret void }35 36 attributes #0 = { noredzone }37...38---39 40# There should be two calls to outlined functions here, since we haven't tripped41# any of the cases above.42name: reg_never_defined43tracksRegLiveness: true44body: |45 bb.0:46 ; CHECK-LABEL: bb.0:47 ; CHECK: BL48 liveins: $w8, $wzr49 $w8 = ORRWri $wzr, 150 $w8 = ORRWri $wzr, 251 $w8 = ORRWri $wzr, 352 $w8 = ORRWri $wzr, 453 bb.1:54 ; CHECK-LABEL: bb.1:55 ; CHECK: BL56 liveins: $w8, $wzr57 $w8 = ORRWri $wzr, 158 $w8 = ORRWri $wzr, 259 $w8 = ORRWri $wzr, 360 $w8 = ORRWri $wzr, 461 bb.2:62 RET undef $lr63...64---65 66name: reg_defined_after_candidate67tracksRegLiveness: true68body: |69 bb.0:70 ; CHECK-LABEL: bb.0:71 ; CHECK: BL72 ; CHECK-NEXT: $x16 = ORRXri $x8, 5, implicit-def $x16, implicit-def $w1673 liveins: $w8, $wzr74 $w8 = ORRWri $wzr, 175 $w8 = ORRWri $wzr, 276 $w8 = ORRWri $wzr, 377 $w8 = ORRWri $wzr, 478 $x16 = ORRXri $x8, 5, implicit-def $x16, implicit-def $w1679 $w8 = ORRWri $w16, 580 RET undef $lr81...82---83 84name: reg_killed_before_candidate85tracksRegLiveness: true86body: |87 bb.0:88 ; CHECK-LABEL: bb.0:89 ; CHECK: BL90 liveins: $w8, $wzr, $x1691 dead $x16 = ORRXri $x8, 692 $w8 = ORRWri $wzr, 193 $w8 = ORRWri $wzr, 294 $w8 = ORRWri $wzr, 395 $w8 = ORRWri $wzr, 496 RET undef $lr97...98---99 100name: x16_live101tracksRegLiveness: true102body: |103 bb.0:104 ; CHECK-LABEL: bb.0:105 ; CHECK-NOT: BL106 liveins: $w8, $wzr, $x16107 $w8 = ORRWri $wzr, 1108 $w8 = ORRWri $wzr, 2109 $w8 = ORRWri $wzr, 3110 $w8 = ORRWri $wzr, 4111 bb.1:112 liveins: $x16113 RET undef $lr114...115---116 117name: x17_live118tracksRegLiveness: true119body: |120 bb.0:121 ; CHECK-LABEL: bb.0:122 ; CHECK-NOT: BL123 liveins: $w8, $wzr, $x17124 $w8 = ORRWri $wzr, 1125 $w8 = ORRWri $wzr, 2126 $w8 = ORRWri $wzr, 3127 $w8 = ORRWri $wzr, 4128 $w8 = ORRWri $w17, 5129 RET undef $lr130...131---132 133name: nzcv_live134tracksRegLiveness: true135body: |136 bb.0:137 liveins: $w8, $wzr, $nzcv138 ; CHECK-LABEL: bb.0:139 ; CHECK-NOT: BL140 $w8 = ORRWri $wzr, 1141 $w8 = ORRWri $wzr, 2142 $w8 = ORRWri $wzr, 3143 $w8 = ORRWri $wzr, 4144 bb.1:145 liveins: $nzcv146 RET undef $lr147...148---149 150name: multiple_ranges151tracksRegLiveness: true152body: |153 bb.0:154 ; CHECK-LABEL: bb.0:155 ; CHECK: BL156 liveins: $w8, $wzr157 $w8 = ORRWri $wzr, 1158 $w8 = ORRWri $wzr, 2159 $w8 = ORRWri $wzr, 3160 $w8 = ORRWri $wzr, 4161 $x16 = ORRXri $x8, 5, implicit-def $x16162 bb.1:163 ; CHECK-LABEL: bb.1:164 ; CHECK-NOT: BL165 liveins: $w8, $x16166 $w8 = ORRWri $wzr, 1167 $w8 = ORRWri $wzr, 2168 $w8 = ORRWri $wzr, 3169 $w8 = ORRWri $wzr, 4170 bb.2:171 ; CHECK-LABEL: bb.2:172 ; CHECK: BL173 liveins: $w8, $x16174 dead $x16 = ORRXri $x8, 0175 $w8 = ORRWri $wzr, 1176 $w8 = ORRWri $wzr, 2177 $w8 = ORRWri $wzr, 3178 $w8 = ORRWri $wzr, 4179 bb.3:180 liveins: $w8181 RET undef $lr182...183---184