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
5 define void @inst_stores_to_dead_spill_implicit_def_impdef() {
9 define void @inst_stores_to_dead_spill_movimm_impdef() {
13 declare void @foo(ptr, i32, ...)
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
22 name: inst_stores_to_dead_spill_implicit_def_impdef
23 tracksRegLiveness: true
29 ; CHECK-LABEL: name: inst_stores_to_dead_spill_implicit_def_impdef
30 ; CHECK: liveins: $x0, $x1
32 ; CHECK-NEXT: STRXui $x0, %stack.0, 0 :: (store (s64) into %stack.0)
33 ; CHECK-NEXT: dead undef [[COPY:%[0-9]+]].sub_32:gpr64 = COPY $x1
34 ; CHECK-NEXT: dead undef [[DEF:%[0-9]+]].sub_32:gpr64 = IMPLICIT_DEF implicit-def %6
35 ; CHECK-NEXT: STRXui %6, %stack.1, 0 :: (store (s64) into %stack.1)
36 ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
37 ; CHECK-NEXT: BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
38 ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
39 ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64common = LDRXui %stack.0, 0 :: (load (s64) from %stack.0)
40 ; CHECK-NEXT: [[LDRXui1:%[0-9]+]]:gpr64 = LDRXui %stack.1, 0 :: (load (s64) from %stack.1)
41 ; CHECK-NEXT: STRXui [[LDRXui1]], [[LDRXui]], 1 :: (store (s64) into stack + 8)
42 ; CHECK-NEXT: STRXui undef %8:gpr64, [[LDRXui]], 0 :: (store (s64) into stack)
43 ; CHECK-NEXT: RET_ReallyLR
45 undef %1.sub_32:gpr64 = COPY $x1
46 undef %2.sub_32:gpr64 = IMPLICIT_DEF implicit-def %1
47 ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
48 BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
49 ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
50 STRXui %1, %0, 1 :: (store (s64) into stack + 8)
51 STRXui undef %1, %0, 0 :: (store (s64) into stack)
56 # Same function, except with a rematerializable mov imm instead of
59 name: inst_stores_to_dead_spill_movimm_impdef
60 tracksRegLiveness: true
66 ; CHECK-LABEL: name: inst_stores_to_dead_spill_movimm_impdef
67 ; CHECK: liveins: $x0, $x1
69 ; CHECK-NEXT: STRXui $x0, %stack.0, 0 :: (store (s64) into %stack.0)
70 ; CHECK-NEXT: dead undef [[COPY:%[0-9]+]].sub_32:gpr64 = COPY $x1
71 ; CHECK-NEXT: dead undef [[MOVi32imm:%[0-9]+]].sub_32:gpr64 = MOVi32imm 4, implicit-def %6
72 ; CHECK-NEXT: STRXui %6, %stack.1, 0 :: (store (s64) into %stack.1)
73 ; CHECK-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
74 ; CHECK-NEXT: BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
75 ; CHECK-NEXT: ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
76 ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64common = LDRXui %stack.0, 0 :: (load (s64) from %stack.0)
77 ; CHECK-NEXT: [[LDRXui1:%[0-9]+]]:gpr64 = LDRXui %stack.1, 0 :: (load (s64) from %stack.1)
78 ; CHECK-NEXT: STRXui [[LDRXui1]], [[LDRXui]], 1 :: (store (s64) into stack + 8)
79 ; CHECK-NEXT: STRXui undef %8:gpr64, [[LDRXui]], 0 :: (store (s64) into stack)
80 ; CHECK-NEXT: RET_ReallyLR
82 undef %1.sub_32:gpr64 = COPY $x1
83 undef %2.sub_32:gpr64 = MOVi32imm 4, implicit-def %1
84 ADJCALLSTACKDOWN 8, 0, implicit-def dead $sp, implicit $sp
85 BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
86 ADJCALLSTACKUP 8, 0, implicit-def dead $sp, implicit $sp
87 STRXui %1, %0, 1 :: (store (s64) into stack + 8)
88 STRXui undef %1, %0, 0 :: (store (s64) into stack)