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))
|
if (!TargetRegisterInfo::isVirtualRegister(Reg))
|
||||||
continue;
|
continue;
|
||||||
LiveInterval &LI = LIS.getInterval(Reg);
|
LiveInterval &LI = LIS.getInterval(Reg);
|
||||||
// Remove defined value.
|
|
||||||
if (MOI->isDef())
|
|
||||||
if (VNInfo *VNI = LI.getVNInfoAt(Idx))
|
|
||||||
LI.removeValNo(VNI);
|
|
||||||
// Shrink read registers.
|
// Shrink read registers.
|
||||||
if (MI->readsVirtualRegister(Reg))
|
if (MI->readsVirtualRegister(Reg))
|
||||||
ToShrink.insert(&LI);
|
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_)
|
if (delegate_)
|
||||||
|
|
Loading…
Reference in New Issue