forked from OSchip/llvm-project
Erase virtual registers that are unused after DCE.
llvm-svn: 127773
This commit is contained in:
parent
e29d63e98a
commit
c738c96519
|
@ -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_)
|
||||
|
|
Loading…
Reference in New Issue