1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
# 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:
adjustsStack: true
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:
adjustsStack: true
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
...
|