96 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 42# RUN: llc -mtriple=arm64-apple-macosx -mcpu=apple-m1 -stress-regalloc=4 -verify-regalloc -run-pass=greedy -o - %s | FileCheck %s3# RUN: llc -mtriple=arm64-apple-macosx -mcpu=apple-m1 -stress-regalloc=4 -verify-regalloc -passes=greedy -o - %s | FileCheck %s4 5--- |6 define void @inst_stores_to_dead_spill_implicit_def_impdef() {7 ret void8 }9 10 define void @inst_stores_to_dead_spill_movimm_impdef() {11 ret void12 }13 14 declare void @foo(ptr, i32, ...)15 16...17 18# The IMPLICIT_DEf has an implicit-def of a different virtual register19# than the main def, so it should not be unconditionally treated as20# rematerializable.21 22---23name: inst_stores_to_dead_spill_implicit_def_impdef24tracksRegLiveness: true25frameInfo:26 adjustsStack: true27 hasCalls: true28body: |29 bb.0:30 liveins: $x0, $x131 ; CHECK-LABEL: name: inst_stores_to_dead_spill_implicit_def_impdef32 ; CHECK: liveins: $x0, $x133 ; CHECK-NEXT: {{ $}}34 ; CHECK-NEXT: STRXui $x0, %stack.0, 0 :: (store (s64) into %stack.0)35 ; CHECK-NEXT: dead undef [[COPY:%[0-9]+]].sub_32:gpr64 = COPY $x136 ; CHECK-NEXT: dead undef [[DEF:%[0-9]+]].sub_32:gpr64 = IMPLICIT_DEF implicit-def %637 ; CHECK-NEXT: STRXui %6, %stack.1, 0 :: (store (s64) into %stack.1)38 ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp39 ; CHECK-NEXT: BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp40 ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp41 ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64common = LDRXui %stack.0, 0 :: (load (s64) from %stack.0)42 ; CHECK-NEXT: [[LDRXui1:%[0-9]+]]:gpr64 = LDRXui %stack.1, 0 :: (load (s64) from %stack.1)43 ; CHECK-NEXT: STRXui [[LDRXui1]], [[LDRXui]], 1 :: (store (s64) into stack + 8)44 ; CHECK-NEXT: STRXui undef %8:gpr64, [[LDRXui]], 0 :: (store (s64) into stack)45 ; CHECK-NEXT: RET_ReallyLR46 %0:gpr64sp = COPY $x047 undef %1.sub_32:gpr64 = COPY $x148 undef %2.sub_32:gpr64 = IMPLICIT_DEF implicit-def %149 ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp50 BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp51 ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp52 STRXui %1, %0, 1 :: (store (s64) into stack + 8)53 STRXui undef %1, %0, 0 :: (store (s64) into stack)54 RET_ReallyLR55 56...57 58# Same function, except with a rematerializable mov imm instead of59# IMPLICIT_DEF60---61name: inst_stores_to_dead_spill_movimm_impdef62tracksRegLiveness: true63frameInfo:64 adjustsStack: true65 hasCalls: true66body: |67 bb.0:68 liveins: $x0, $x169 ; CHECK-LABEL: name: inst_stores_to_dead_spill_movimm_impdef70 ; CHECK: liveins: $x0, $x171 ; CHECK-NEXT: {{ $}}72 ; CHECK-NEXT: STRXui $x0, %stack.0, 0 :: (store (s64) into %stack.0)73 ; CHECK-NEXT: dead undef [[COPY:%[0-9]+]].sub_32:gpr64 = COPY $x174 ; CHECK-NEXT: dead undef [[MOVi32imm:%[0-9]+]].sub_32:gpr64 = MOVi32imm 4, implicit-def %675 ; CHECK-NEXT: STRXui %6, %stack.1, 0 :: (store (s64) into %stack.1)76 ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp77 ; CHECK-NEXT: BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp78 ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp79 ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64common = LDRXui %stack.0, 0 :: (load (s64) from %stack.0)80 ; CHECK-NEXT: [[LDRXui1:%[0-9]+]]:gpr64 = LDRXui %stack.1, 0 :: (load (s64) from %stack.1)81 ; CHECK-NEXT: STRXui [[LDRXui1]], [[LDRXui]], 1 :: (store (s64) into stack + 8)82 ; CHECK-NEXT: STRXui undef %8:gpr64, [[LDRXui]], 0 :: (store (s64) into stack)83 ; CHECK-NEXT: RET_ReallyLR84 %0:gpr64sp = COPY $x085 undef %1.sub_32:gpr64 = COPY $x186 undef %2.sub_32:gpr64 = MOVi32imm 4, implicit-def %187 ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp88 BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp89 ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp90 STRXui %1, %0, 1 :: (store (s64) into stack + 8)91 STRXui undef %1, %0, 0 :: (store (s64) into stack)92 RET_ReallyLR93 94...95 96