| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 |
| # RUN: llc -mtriple=arm64-apple-macosx -mcpu=apple-m1 -stress-regalloc=4 -verify-regalloc -run-pass=greedy -o - %s | FileCheck %s |
| |
| --- | |
| define void @inst_stores_to_dead_spill_implicit_def_impdef() { |
| ret void |
| } |
| |
| define void @inst_stores_to_dead_spill_movimm_impdef() { |
| ret void |
| } |
| |
| declare void @foo(ptr, i32, ...) |
| |
| ... |
| |
| # The IMPLICIT_DEf has an implicit-def of a different virtual register |
| # than the main def, so it should not be unconditionally treated as |
| # rematerializable. |
| |
| --- |
| name: inst_stores_to_dead_spill_implicit_def_impdef |
| tracksRegLiveness: true |
| frameInfo: |
| hasCalls: true |
| body: | |
| bb.0: |
| liveins: $x0, $x1 |
| ; CHECK-LABEL: name: inst_stores_to_dead_spill_implicit_def_impdef |
| ; CHECK: liveins: $x0, $x1 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: STRXui $x0, %stack.0, 0 :: (store (s64) into %stack.0) |
| ; CHECK-NEXT: dead undef [[COPY:%[0-9]+]].sub_32:gpr64 = COPY $x1 |
| ; CHECK-NEXT: dead undef [[DEF:%[0-9]+]].sub_32:gpr64 = IMPLICIT_DEF implicit-def %6 |
| ; CHECK-NEXT: STRXui %6, %stack.1, 0 :: (store (s64) into %stack.1) |
| ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp |
| ; CHECK-NEXT: BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp |
| ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp |
| ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64common = LDRXui %stack.0, 0 :: (load (s64) from %stack.0) |
| ; CHECK-NEXT: [[LDRXui1:%[0-9]+]]:gpr64 = LDRXui %stack.1, 0 :: (load (s64) from %stack.1) |
| ; CHECK-NEXT: STRXui [[LDRXui1]], [[LDRXui]], 1 :: (store (s64) into stack + 8) |
| ; CHECK-NEXT: STRXui undef %8:gpr64, [[LDRXui]], 0 :: (store (s64) into stack) |
| ; CHECK-NEXT: RET_ReallyLR |
| %0:gpr64sp = COPY $x0 |
| undef %1.sub_32:gpr64 = COPY $x1 |
| undef %2.sub_32:gpr64 = IMPLICIT_DEF implicit-def %1 |
| ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp |
| BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp |
| ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp |
| STRXui %1, %0, 1 :: (store (s64) into stack + 8) |
| STRXui undef %1, %0, 0 :: (store (s64) into stack) |
| RET_ReallyLR |
| |
| ... |
| |
| # Same function, except with a rematerializable mov imm instead of |
| # IMPLICIT_DEF |
| --- |
| name: inst_stores_to_dead_spill_movimm_impdef |
| tracksRegLiveness: true |
| frameInfo: |
| hasCalls: true |
| body: | |
| bb.0: |
| liveins: $x0, $x1 |
| ; CHECK-LABEL: name: inst_stores_to_dead_spill_movimm_impdef |
| ; CHECK: liveins: $x0, $x1 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: STRXui $x0, %stack.0, 0 :: (store (s64) into %stack.0) |
| ; CHECK-NEXT: dead undef [[COPY:%[0-9]+]].sub_32:gpr64 = COPY $x1 |
| ; CHECK-NEXT: dead undef [[MOVi32imm:%[0-9]+]].sub_32:gpr64 = MOVi32imm 4, implicit-def %6 |
| ; CHECK-NEXT: STRXui %6, %stack.1, 0 :: (store (s64) into %stack.1) |
| ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp |
| ; CHECK-NEXT: BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp |
| ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp |
| ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64common = LDRXui %stack.0, 0 :: (load (s64) from %stack.0) |
| ; CHECK-NEXT: [[LDRXui1:%[0-9]+]]:gpr64 = LDRXui %stack.1, 0 :: (load (s64) from %stack.1) |
| ; CHECK-NEXT: STRXui [[LDRXui1]], [[LDRXui]], 1 :: (store (s64) into stack + 8) |
| ; CHECK-NEXT: STRXui undef %8:gpr64, [[LDRXui]], 0 :: (store (s64) into stack) |
| ; CHECK-NEXT: RET_ReallyLR |
| %0:gpr64sp = COPY $x0 |
| undef %1.sub_32:gpr64 = COPY $x1 |
| undef %2.sub_32:gpr64 = MOVi32imm 4, implicit-def %1 |
| ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp |
| BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp |
| ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp |
| STRXui %1, %0, 1 :: (store (s64) into stack + 8) |
| STRXui undef %1, %0, 0 :: (store (s64) into stack) |
| RET_ReallyLR |
| |
| ... |
| |