Erase virtual registers that are unused after DCE.

llvm-svn: 127773
This commit is contained in:
Jakob Stoklund Olesen 2011-03-16 22:56:13 +00:00
parent e29d63e98a
commit c738c96519
1 changed files with 12 additions and 4 deletions

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_)