1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 2# RUN: llc -mtriple=arm64-apple-macosx -mcpu=apple-m1 -stress-regalloc=4 -verify-regalloc -run-pass=greedy -o - %s | FileCheck %s 3 4--- | 5 define void @inst_stores_to_dead_spill_implicit_def_impdef() { 6 ret void 7 } 8 9 define void @inst_stores_to_dead_spill_movimm_impdef() { 10 ret void 11 } 12 13 declare void @foo(ptr, i32, ...) 14 15... 16 17# The IMPLICIT_DEf has an implicit-def of a different virtual register 18# than the main def, so it should not be unconditionally treated as 19# rematerializable. 20 21--- 22name: inst_stores_to_dead_spill_implicit_def_impdef 23tracksRegLiveness: true 24frameInfo: 25 adjustsStack: true 26 hasCalls: true 27body: | 28 bb.0: 29 liveins: $x0, $x1 30 ; CHECK-LABEL: name: inst_stores_to_dead_spill_implicit_def_impdef 31 ; CHECK: liveins: $x0, $x1 32 ; CHECK-NEXT: {{ $}} 33 ; CHECK-NEXT: STRXui $x0, %stack.0, 0 :: (store (s64) into %stack.0) 34 ; CHECK-NEXT: dead undef [[COPY:%[0-9]+]].sub_32:gpr64 = COPY $x1 35 ; CHECK-NEXT: dead undef [[DEF:%[0-9]+]].sub_32:gpr64 = IMPLICIT_DEF implicit-def %6 36 ; CHECK-NEXT: STRXui %6, %stack.1, 0 :: (store (s64) into %stack.1) 37 ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp 38 ; CHECK-NEXT: BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp 39 ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp 40 ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64common = LDRXui %stack.0, 0 :: (load (s64) from %stack.0) 41 ; CHECK-NEXT: [[LDRXui1:%[0-9]+]]:gpr64 = LDRXui %stack.1, 0 :: (load (s64) from %stack.1) 42 ; CHECK-NEXT: STRXui [[LDRXui1]], [[LDRXui]], 1 :: (store (s64) into stack + 8) 43 ; CHECK-NEXT: STRXui undef %8:gpr64, [[LDRXui]], 0 :: (store (s64) into stack) 44 ; CHECK-NEXT: RET_ReallyLR 45 %0:gpr64sp = COPY $x0 46 undef %1.sub_32:gpr64 = COPY $x1 47 undef %2.sub_32:gpr64 = IMPLICIT_DEF implicit-def %1 48 ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp 49 BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp 50 ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp 51 STRXui %1, %0, 1 :: (store (s64) into stack + 8) 52 STRXui undef %1, %0, 0 :: (store (s64) into stack) 53 RET_ReallyLR 54 55... 56 57# Same function, except with a rematerializable mov imm instead of 58# IMPLICIT_DEF 59--- 60name: inst_stores_to_dead_spill_movimm_impdef 61tracksRegLiveness: true 62frameInfo: 63 adjustsStack: true 64 hasCalls: true 65body: | 66 bb.0: 67 liveins: $x0, $x1 68 ; CHECK-LABEL: name: inst_stores_to_dead_spill_movimm_impdef 69 ; CHECK: liveins: $x0, $x1 70 ; CHECK-NEXT: {{ $}} 71 ; CHECK-NEXT: STRXui $x0, %stack.0, 0 :: (store (s64) into %stack.0) 72 ; CHECK-NEXT: dead undef [[COPY:%[0-9]+]].sub_32:gpr64 = COPY $x1 73 ; CHECK-NEXT: dead undef [[MOVi32imm:%[0-9]+]].sub_32:gpr64 = MOVi32imm 4, implicit-def %6 74 ; CHECK-NEXT: STRXui %6, %stack.1, 0 :: (store (s64) into %stack.1) 75 ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp 76 ; CHECK-NEXT: BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp 77 ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp 78 ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64common = LDRXui %stack.0, 0 :: (load (s64) from %stack.0) 79 ; CHECK-NEXT: [[LDRXui1:%[0-9]+]]:gpr64 = LDRXui %stack.1, 0 :: (load (s64) from %stack.1) 80 ; CHECK-NEXT: STRXui [[LDRXui1]], [[LDRXui]], 1 :: (store (s64) into stack + 8) 81 ; CHECK-NEXT: STRXui undef %8:gpr64, [[LDRXui]], 0 :: (store (s64) into stack) 82 ; CHECK-NEXT: RET_ReallyLR 83 %0:gpr64sp = COPY $x0 84 undef %1.sub_32:gpr64 = COPY $x1 85 undef %2.sub_32:gpr64 = MOVi32imm 4, implicit-def %1 86 ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp 87 BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp 88 ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp 89 STRXui %1, %0, 1 :: (store (s64) into stack + 8) 90 STRXui undef %1, %0, 0 :: (store (s64) into stack) 91 RET_ReallyLR 92 93... 94 95