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 4 5--- | 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"() 13 14 attributes #0 = { minsize optsize } 15 attributes #1 = { minsize optsize "target-features"="+armv7-a,+thumb-mode" } 16... 17--- 18 19name: outline_call_arm 20tracksRegLiveness: true 21body: | 22 ; CHECK-LABEL: name: outline_call_arm 23 ; CHECK: bb.0: 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 30 ; CHECK: bb.1: 31 ; CHECK: BL @OUTLINED_FUNCTION_0 32 ; CHECK: bb.2: 33 ; CHECK: BL @OUTLINED_FUNCTION_0 34 ; CHECK: bb.3: 35 ; CHECK: BL @OUTLINED_FUNCTION_0 36 ; CHECK: bb.4: 37 ; CHECK: BL @OUTLINED_FUNCTION_0 38 ; CHECK: bb.5: 39 ; CHECK: $sp = frame-destroy LDMIA_UPD $sp, 14 /* CC::al */, $noreg, def $r4, def $lr 40 ; CHECK: BX_RET 14 /* CC::al */, $noreg 41 bb.0: 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 48 bb.1: 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 55 bb.2: 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 62 bb.3: 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 69 bb.4: 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 76 bb.5: 77 BX_RET 14, $noreg 78... 79--- 80 81name: outline_call_thumb 82tracksRegLiveness: true 83body: | 84 ; CHECK-LABEL: name: outline_call_thumb 85 ; CHECK: bb.0: 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_3 92 ; CHECK: bb.1: 93 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3 94 ; CHECK: bb.2: 95 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3 96 ; CHECK: bb.3: 97 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3 98 ; CHECK: bb.4: 99 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3 100 ; CHECK: bb.5: 101 ; CHECK: $sp = frame-destroy t2LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r7, def $pc 102 bb.0: 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 107 bb.1: 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 112 bb.2: 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 117 bb.3: 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 122 bb.4: 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 127 bb.5: 128 tBX_RET 14, $noreg 129... 130--- 131 132name: outline_call_tailcall_arm 133tracksRegLiveness: true 134body: | 135 ; CHECK-LABEL: name: outline_call_tailcall_arm 136 ; CHECK: bb.0: 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_2 143 ; CHECK: bb.1: 144 ; CHECK: BL @OUTLINED_FUNCTION_2 145 ; CHECK: bb.2: 146 ; CHECK: BL @OUTLINED_FUNCTION_2 147 ; CHECK: bb.3: 148 ; CHECK: $sp = frame-destroy LDMIA_UPD $sp, 14 /* CC::al */, $noreg, def $r4, def $lr 149 ; CHECK: BX_RET 14 /* CC::al */, $noreg 150 bb.0: 151 BL @bar, implicit-def dead $lr, implicit $sp 152 $r0 = MOVi 2, 14, $noreg, $noreg 153 $r1 = MOVi 2, 14, $noreg, $noreg 154 $r2 = MOVi 2, 14, $noreg, $noreg 155 $r3 = MOVi 2, 14, $noreg, $noreg 156 $r4 = MOVi 2, 14, $noreg, $noreg 157 BL @bar, implicit-def dead $lr, implicit $sp 158 bb.1: 159 BL @bar, implicit-def dead $lr, implicit $sp 160 $r0 = MOVi 2, 14, $noreg, $noreg 161 $r1 = MOVi 2, 14, $noreg, $noreg 162 $r2 = MOVi 2, 14, $noreg, $noreg 163 $r3 = MOVi 2, 14, $noreg, $noreg 164 $r4 = MOVi 2, 14, $noreg, $noreg 165 BL @bar, implicit-def dead $lr, implicit $sp 166 bb.2: 167 BL @bar, implicit-def dead $lr, implicit $sp 168 $r0 = MOVi 2, 14, $noreg, $noreg 169 $r1 = MOVi 2, 14, $noreg, $noreg 170 $r2 = MOVi 2, 14, $noreg, $noreg 171 $r3 = MOVi 2, 14, $noreg, $noreg 172 $r4 = MOVi 2, 14, $noreg, $noreg 173 BL @bar, implicit-def dead $lr, implicit $sp 174 bb.3: 175 BX_RET 14, $noreg 176... 177--- 178 179name: outline_call_tailcall_thumb 180tracksRegLiveness: true 181body: | 182 ; CHECK-LABEL: name: outline_call_tailcall_thumb 183 ; CHECK: bb.0: 184 ; CHECK: liveins: $r7, $lr 185 ; CHECK: $sp = frame-setup t2STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r7, killed $lr 186 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8 187 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4 188 ; CHECK: frame-setup CFI_INSTRUCTION offset $r7, -8 189 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_4 190 ; CHECK: bb.1: 191 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_4 192 ; CHECK: bb.2: 193 ; CHECK: tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_4 194 ; CHECK: bb.3: 195 ; CHECK: $sp = frame-destroy t2LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r7, def $pc 196 bb.0: 197 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp 198 $r0 = t2MOVi 2, 14, $noreg, $noreg 199 $r1 = t2MOVi 2, 14, $noreg, $noreg 200 $r2 = t2MOVi 2, 14, $noreg, $noreg 201 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp 202 bb.1: 203 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp 204 $r0 = t2MOVi 2, 14, $noreg, $noreg 205 $r1 = t2MOVi 2, 14, $noreg, $noreg 206 $r2 = t2MOVi 2, 14, $noreg, $noreg 207 tBL 14, $noreg, @bar, implicit-def dead $lr, implicit $sp 208 bb.2: 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 214 bb.3: 215 tBX_RET 14, $noreg 216... 217--- 218 219name: outline_call_KO_mcount 220tracksRegLiveness: true 221body: | 222 ; CHECK-LABEL: name: outline_call_KO_mcount 223 ; CHECK: bb.0: 224 ; CHECK: liveins: $r4, $lr 225 ; CHECK: $sp = frame-setup STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r4, killed $lr 226 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8 227 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4 228 ; CHECK: frame-setup CFI_INSTRUCTION offset $r4, -8 229 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 230 ; CHECK: BL @OUTLINED_FUNCTION_1 231 ; CHECK: bb.1: 232 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 233 ; CHECK: BL @OUTLINED_FUNCTION_1 234 ; CHECK: bb.2: 235 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 236 ; CHECK: BL @OUTLINED_FUNCTION_1 237 ; CHECK: bb.3: 238 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 239 ; CHECK: BL @OUTLINED_FUNCTION_1 240 ; CHECK: bb.4: 241 ; CHECK: BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 242 ; CHECK: BL @OUTLINED_FUNCTION_1 243 ; CHECK: bb.5: 244 ; CHECK: $sp = frame-destroy LDMIA_UPD $sp, 14 /* CC::al */, $noreg, def $r4, def $lr 245 ; CHECK: BX_RET 14 /* CC::al */, $noreg 246 bb.0: 247 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 248 $r0 = MOVi 3, 14, $noreg, $noreg 249 $r1 = MOVi 3, 14, $noreg, $noreg 250 $r2 = MOVi 3, 14, $noreg, $noreg 251 $r3 = MOVi 3, 14, $noreg, $noreg 252 $r4 = MOVi 3, 14, $noreg, $noreg 253 bb.1: 254 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 255 $r0 = MOVi 3, 14, $noreg, $noreg 256 $r1 = MOVi 3, 14, $noreg, $noreg 257 $r2 = MOVi 3, 14, $noreg, $noreg 258 $r3 = MOVi 3, 14, $noreg, $noreg 259 $r4 = MOVi 3, 14, $noreg, $noreg 260 bb.2: 261 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 262 $r0 = MOVi 3, 14, $noreg, $noreg 263 $r1 = MOVi 3, 14, $noreg, $noreg 264 $r2 = MOVi 3, 14, $noreg, $noreg 265 $r3 = MOVi 3, 14, $noreg, $noreg 266 $r4 = MOVi 3, 14, $noreg, $noreg 267 bb.3: 268 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 269 $r0 = MOVi 3, 14, $noreg, $noreg 270 $r1 = MOVi 3, 14, $noreg, $noreg 271 $r2 = MOVi 3, 14, $noreg, $noreg 272 $r3 = MOVi 3, 14, $noreg, $noreg 273 $r4 = MOVi 3, 14, $noreg, $noreg 274 bb.4: 275 BL @"\01mcount", csr_aapcs, implicit-def dead $lr, implicit $sp 276 $r0 = MOVi 3, 14, $noreg, $noreg 277 $r1 = MOVi 3, 14, $noreg, $noreg 278 $r2 = MOVi 3, 14, $noreg, $noreg 279 $r3 = MOVi 3, 14, $noreg, $noreg 280 $r4 = MOVi 3, 14, $noreg, $noreg 281 bb.5: 282 BX_RET 14, $noreg 283... 284--- 285 286name: bar 287tracksRegLiveness: true 288body: | 289 bb.0: 290 BX_RET 14, $noreg 291 292 293 ; CHECK-LABEL: name: OUTLINED_FUNCTION_0 294 ; CHECK: bb.0: 295 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r7, $r6, $r5, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8, $lr 296 ; CHECK: early-clobber $sp = STR_PRE_IMM killed $lr, $sp, -8, 14 /* CC::al */, $noreg 297 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8 298 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -8 299 ; CHECK: BL @bar, implicit-def dead $lr, implicit $sp 300 ; CHECK: $r0 = MOVi 1, 14 /* CC::al */, $noreg, $noreg 301 ; CHECK: $r1 = MOVi 1, 14 /* CC::al */, $noreg, $noreg 302 ; CHECK: $r2 = MOVi 1, 14 /* CC::al */, $noreg, $noreg 303 ; CHECK: $r3 = MOVi 1, 14 /* CC::al */, $noreg, $noreg 304 ; CHECK: $r4 = MOVi 1, 14 /* CC::al */, $noreg, $noreg 305 ; CHECK: $lr, $sp = LDR_POST_IMM $sp, $noreg, 8, 14 /* CC::al */, $noreg 306 ; CHECK: MOVPCLR 14 /* CC::al */, $noreg 307 308 ; CHECK-LABEL: name: OUTLINED_FUNCTION_1 309 ; CHECK: bb.0: 310 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r7, $r6, $r5, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8 311 ; CHECK: $r0 = MOVi 3, 14 /* CC::al */, $noreg, $noreg 312 ; CHECK: $r1 = MOVi 3, 14 /* CC::al */, $noreg, $noreg 313 ; CHECK: $r2 = MOVi 3, 14 /* CC::al */, $noreg, $noreg 314 ; CHECK: $r3 = MOVi 3, 14 /* CC::al */, $noreg, $noreg 315 ; CHECK: $r4 = MOVi 3, 14 /* CC::al */, $noreg, $noreg 316 ; CHECK: MOVPCLR 14 /* CC::al */, $noreg 317 318 ; CHECK-LABEL: name: OUTLINED_FUNCTION_2 319 ; CHECK: bb.0: 320 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r7, $r6, $r5, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8, $lr 321 ; CHECK: early-clobber $sp = STR_PRE_IMM killed $lr, $sp, -8, 14 /* CC::al */, $noreg 322 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8 323 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -8 324 ; CHECK: BL @bar, implicit-def dead $lr, implicit $sp 325 ; CHECK: $r0 = MOVi 2, 14 /* CC::al */, $noreg, $noreg 326 ; CHECK: $r1 = MOVi 2, 14 /* CC::al */, $noreg, $noreg 327 ; CHECK: $r2 = MOVi 2, 14 /* CC::al */, $noreg, $noreg 328 ; CHECK: $r3 = MOVi 2, 14 /* CC::al */, $noreg, $noreg 329 ; CHECK: $r4 = MOVi 2, 14 /* CC::al */, $noreg, $noreg 330 ; CHECK: $lr, $sp = LDR_POST_IMM $sp, $noreg, 8, 14 /* CC::al */, $noreg 331 ; CHECK: TAILJMPd @bar, implicit $sp 332 333 ; CHECK-LABEL: name: OUTLINED_FUNCTION_3 334 ; CHECK: bb.0: 335 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r6, $r5, $r4, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8, $lr 336 ; CHECK: early-clobber $sp = t2STR_PRE killed $lr, $sp, -8, 14 /* CC::al */, $noreg 337 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8 338 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -8 339 ; CHECK: tBL 14 /* CC::al */, $noreg, @bar, implicit-def dead $lr, implicit $sp 340 ; CHECK: $r0 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg 341 ; CHECK: $r1 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg 342 ; CHECK: $r2 = t2MOVi 1, 14 /* CC::al */, $noreg, $noreg 343 ; CHECK: $lr, $sp = t2LDR_POST $sp, 8, 14 /* CC::al */, $noreg 344 ; CHECK: tBX_RET 14 /* CC::al */, $noreg 345 346 ; CHECK-LABEL: name: OUTLINED_FUNCTION_4 347 ; CHECK: bb.0: 348 ; CHECK: liveins: $r11, $r10, $r9, $r8, $r6, $r5, $r4, $d15, $d14, $d13, $d12, $d11, $d10, $d9, $d8, $lr 349 ; CHECK: early-clobber $sp = t2STR_PRE killed $lr, $sp, -8, 14 /* CC::al */, $noreg 350 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8 351 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -8 352 ; CHECK: tBL 14 /* CC::al */, $noreg, @bar, implicit-def dead $lr, implicit $sp 353 ; CHECK: $r0 = t2MOVi 2, 14 /* CC::al */, $noreg, $noreg 354 ; CHECK: $r1 = t2MOVi 2, 14 /* CC::al */, $noreg, $noreg 355 ; CHECK: $r2 = t2MOVi 2, 14 /* CC::al */, $noreg, $noreg 356 ; CHECK: $lr, $sp = t2LDR_POST $sp, 8, 14 /* CC::al */, $noreg 357 ; CHECK: tTAILJMPdND @bar, 14 /* CC::al */, $noreg, implicit $sp 358 359 360 361