mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-20 14:29:27 +00:00
Fixed PR4090.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71495 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5792f51e12
commit
9c992f1141
@ -608,14 +608,29 @@ bool SimpleRegisterCoalescing::ReMaterializeTrivialDef(LiveInterval &SrcInt,
|
|||||||
|
|
||||||
// If copy kills the source register, find the last use and propagate
|
// If copy kills the source register, find the last use and propagate
|
||||||
// kill.
|
// kill.
|
||||||
|
bool checkForDeadDef = false;
|
||||||
MachineBasicBlock *MBB = CopyMI->getParent();
|
MachineBasicBlock *MBB = CopyMI->getParent();
|
||||||
if (CopyMI->killsRegister(SrcInt.reg))
|
if (CopyMI->killsRegister(SrcInt.reg))
|
||||||
TrimLiveIntervalToLastUse(CopyIdx, MBB, SrcInt, SrcLR);
|
if (!TrimLiveIntervalToLastUse(CopyIdx, MBB, SrcInt, SrcLR)) {
|
||||||
|
checkForDeadDef = true;
|
||||||
|
}
|
||||||
|
|
||||||
MachineBasicBlock::iterator MII = next(MachineBasicBlock::iterator(CopyMI));
|
MachineBasicBlock::iterator MII = next(MachineBasicBlock::iterator(CopyMI));
|
||||||
CopyMI->removeFromParent();
|
CopyMI->removeFromParent();
|
||||||
tii_->reMaterialize(*MBB, MII, DstReg, DefMI);
|
tii_->reMaterialize(*MBB, MII, DstReg, DefMI);
|
||||||
MachineInstr *NewMI = prior(MII);
|
MachineInstr *NewMI = prior(MII);
|
||||||
|
|
||||||
|
if (checkForDeadDef) {
|
||||||
|
// PR4090 fix: Trim interval failed because there was no use of the
|
||||||
|
// source interval in this MBB. If the def is in this MBB too then we
|
||||||
|
// should mark it dead:
|
||||||
|
if (DefMI->getParent() == MBB) {
|
||||||
|
DefMI->addRegisterDead(SrcInt.reg, tri_);
|
||||||
|
SrcLR->end = SrcLR->start + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// CopyMI may have implicit operands, transfer them over to the newly
|
// CopyMI may have implicit operands, transfer them over to the newly
|
||||||
// rematerialized instruction. And update implicit def interval valnos.
|
// rematerialized instruction. And update implicit def interval valnos.
|
||||||
for (unsigned i = CopyMI->getDesc().getNumOperands(),
|
for (unsigned i = CopyMI->getDesc().getNumOperands(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user