mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
Update physreg live intervals during remat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184574 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c6bae79adb
commit
c12c880998
@ -1054,6 +1054,34 @@ foldMemoryOperand(ArrayRef<std::pair<MachineInstr*, unsigned> > Ops,
|
|||||||
: TII.foldMemoryOperand(MI, FoldOps, StackSlot);
|
: TII.foldMemoryOperand(MI, FoldOps, StackSlot);
|
||||||
if (!FoldMI)
|
if (!FoldMI)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Remove LIS for any dead defs in the original MI not in FoldMI.
|
||||||
|
for (MIBundleOperands MO(MI); MO.isValid(); ++MO) {
|
||||||
|
if (!MO->isReg())
|
||||||
|
continue;
|
||||||
|
unsigned Reg = MO->getReg();
|
||||||
|
if (!Reg || TargetRegisterInfo::isVirtualRegister(Reg) ||
|
||||||
|
MRI.isReserved(Reg)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MIBundleOperands::PhysRegInfo RI =
|
||||||
|
MIBundleOperands(FoldMI).analyzePhysReg(Reg, &TRI);
|
||||||
|
if (MO->readsReg()) {
|
||||||
|
assert(RI.Reads && "Cannot fold physreg reader");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (RI.Defines)
|
||||||
|
continue;
|
||||||
|
// FoldMI does not define this physreg. Remove the LI segment.
|
||||||
|
assert(MO->isDead() && "Cannot fold physreg def");
|
||||||
|
for (MCRegUnitIterator Units(Reg, &TRI); Units.isValid(); ++Units) {
|
||||||
|
if (LiveInterval *LI = LIS.getCachedRegUnit(*Units)) {
|
||||||
|
SlotIndex Idx = LIS.getInstructionIndex(MI).getRegSlot();
|
||||||
|
if (VNInfo *VNI = LI->getVNInfoAt(Idx))
|
||||||
|
LI->removeValNo(VNI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
LIS.ReplaceMachineInstrInMaps(MI, FoldMI);
|
LIS.ReplaceMachineInstrInMaps(MI, FoldMI);
|
||||||
MI->eraseFromParent();
|
MI->eraseFromParent();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
; RUN: llc -march=x86 < %s -verify-machineinstrs
|
; RUN: llc -march=x86 < %s -verify-machineinstrs -precompute-phys-liveness
|
||||||
; RUN: llc -march=x86-64 < %s -verify-machineinstrs
|
; RUN: llc -march=x86-64 < %s -verify-machineinstrs -precompute-phys-liveness
|
||||||
|
|
||||||
; PR6497
|
; PR6497
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user