Handle more cases in LiveRangeEdit::eliminateDeadDefs.

Live intervals for dead physregs may be created during coalescing. We
need to update these in the event that their instruction goes away.

crash.ll is the unit test that catches it when MI sched is enabled on
X86.

llvm-svn: 184572
This commit is contained in:
Andrew Trick 2013-06-21 18:33:20 +00:00
parent 530fc1f486
commit 6b9c49a275
2 changed files with 13 additions and 4 deletions

View File

@ -58,10 +58,6 @@ class MachineRegisterInfo {
/// physical registers.
MachineOperand **PhysRegUseDefLists;
const TargetRegisterInfo *getTargetRegisterInfo() const {
return TM.getRegisterInfo();
}
/// getRegUseDefListHead - Return the head pointer for the register use/def
/// list for the specified virtual or physical register.
MachineOperand *&getRegUseDefListHead(unsigned RegNo) {
@ -116,6 +112,10 @@ public:
explicit MachineRegisterInfo(const TargetMachine &TM);
~MachineRegisterInfo();
const TargetRegisterInfo *getTargetRegisterInfo() const {
return TM.getRegisterInfo();
}
//===--------------------------------------------------------------------===//
// Function State
//===--------------------------------------------------------------------===//

View File

@ -249,6 +249,15 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink) {
// Check if MI reads any unreserved physregs.
if (Reg && MOI->readsReg() && !MRI.isReserved(Reg))
ReadsPhysRegs = true;
else if (MOI->isDef()) {
for (MCRegUnitIterator Units(Reg, MRI.getTargetRegisterInfo());
Units.isValid(); ++Units) {
if (LiveInterval *LI = LIS.getCachedRegUnit(*Units)) {
if (VNInfo *VNI = LI->getVNInfoAt(Idx))
LI->removeValNo(VNI);
}
}
}
continue;
}
LiveInterval &LI = LIS.getInterval(Reg);