diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-16 22:56:13 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-16 22:56:13 +0000 |
commit | cc5c4296fda7270e8394626d7254596f5f9c8d82 (patch) | |
tree | 8730d7e136f733d8cbe5a87f688ea075dd7d1c59 | |
parent | 2926733240d0766fbd45df6eb609ad2328f0307d (diff) | |
download | external_llvm-cc5c4296fda7270e8394626d7254596f5f9c8d82.zip external_llvm-cc5c4296fda7270e8394626d7254596f5f9c8d82.tar.gz external_llvm-cc5c4296fda7270e8394626d7254596f5f9c8d82.tar.bz2 |
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
-rw-r--r-- | lib/CodeGen/LiveRangeEdit.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/CodeGen/LiveRangeEdit.cpp b/lib/CodeGen/LiveRangeEdit.cpp index 0769f95..e994d8c 100644 --- a/lib/CodeGen/LiveRangeEdit.cpp +++ b/lib/CodeGen/LiveRangeEdit.cpp @@ -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_) |