forked from OSchip/llvm-project
[Statepoints] FixupStatepoint: properly set isKill on spilled register.
When spilling statepoint meta arg register it is incorrect to blindly mark it as killed - it may be used in non-meta args (e.g., as call parameter).
This commit is contained in:
parent
891b2be85d
commit
1c80a6ce5f
|
@ -157,12 +157,14 @@ static Register performCopyPropagation(Register Reg,
|
|||
MachineBasicBlock::iterator &RI,
|
||||
bool &IsKill, const TargetInstrInfo &TII,
|
||||
const TargetRegisterInfo &TRI) {
|
||||
if (!EnableCopyProp)
|
||||
return Reg;
|
||||
|
||||
// First check if statepoint itself uses Reg in non-meta operands.
|
||||
int Idx = RI->findRegisterUseOperandIdx(Reg, false, &TRI);
|
||||
if (Idx >= 0 && (unsigned)Idx < StatepointOpers(&*RI).getNumDeoptArgsIdx())
|
||||
if (Idx >= 0 && (unsigned)Idx < StatepointOpers(&*RI).getNumDeoptArgsIdx()) {
|
||||
IsKill = false;
|
||||
return Reg;
|
||||
}
|
||||
|
||||
if (!EnableCopyProp)
|
||||
return Reg;
|
||||
|
||||
MachineBasicBlock *MBB = RI->getParent();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
||||
# RUN: llc -o - %s -run-pass fixup-statepoint-caller-saved | FileCheck %s
|
||||
# RUN: llc -o - %s -run-pass fixup-statepoint-caller-saved -verify-machineinstrs | FileCheck %s
|
||||
|
||||
# Check that COPY is not eliminated if dest register is used in
|
||||
# non-meta arguments of statepoint.
|
||||
|
@ -76,7 +76,7 @@ body: |
|
|||
; CHECK: liveins: $rcx, $rsi
|
||||
; CHECK: renamable $rdi = COPY $rsi
|
||||
; CHECK: MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed renamable $rcx :: (store 8 into %stack.0)
|
||||
; CHECK: MOV64mr %stack.1, 1, $noreg, 0, $noreg, killed $rdi :: (store 8 into %stack.1)
|
||||
; CHECK: MOV64mr %stack.1, 1, $noreg, 0, $noreg, $rdi :: (store 8 into %stack.1)
|
||||
; CHECK: STATEPOINT 0, 0, 1, @foo, $rdi, 2, 0, 2, 0, 2, 1, 1, 8, %stack.1, 0, 1, 8, %stack.0, 0, 1, 8, %stack.0, 0, csr_64, implicit-def $rsp, implicit-def $ssp :: (volatile load store 8 on %stack.0), (load 8 from %stack.1)
|
||||
; CHECK: renamable $rax = MOV64rm %stack.0, 1, $noreg, 0, $noreg :: (load 8 from %stack.0)
|
||||
; CHECK: RET 0, $rax
|
||||
|
|
Loading…
Reference in New Issue