Erase virtual registers that are unused after DCE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127773 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2011-03-16 22:56:13 +00:00
parent 2926733240
commit cc5c4296fd

View File

@ -174,13 +174,21 @@ void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl<MachineInstr*> &Dead,
if (!TargetRegisterInfo::isVirtualRegister(Reg))
continue;
LiveInterval &LI = LIS.getInterval(Reg);
// Remove defined value.
if (MOI->isDef())
if (VNInfo *VNI = LI.getVNInfoAt(Idx))
LI.removeValNo(VNI);
// Shrink read registers.
if (MI->readsVirtualRegister(Reg))
ToShrink.insert(&LI);
// Remove defined value.
if (MOI->isDef()) {
if (VNInfo *VNI = LI.getVNInfoAt(Idx)) {
LI.removeValNo(VNI);
if (LI.empty()) {
ToShrink.remove(&LI);
eraseVirtReg(Reg, LIS);
}
}
}
}
if (delegate_)