aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-07 23:29:10 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-07 23:29:10 +0000
commit0d8ccaa5c8db820b5b93f37e51563148c57ba6b8 (patch)
tree58f7b1574c7c4d15cf1fa16aaffde8c41db5b31c /lib
parentd756eceb83fc9a7536f76adfe24cdb19d4c2f253 (diff)
Let shrinkToUses optionally return a list of now dead machine instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 4dda548548..8a2db3e1a3 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -746,7 +746,8 @@ LiveInterval* LiveIntervals::dupInterval(LiveInterval *li) {
/// shrinkToUses - After removing some uses of a register, shrink its live
/// range to just the remaining uses. This method does not compute reaching
/// defs for new uses, and it doesn't remove dead defs.
-void LiveIntervals::shrinkToUses(LiveInterval *li) {
+void LiveIntervals::shrinkToUses(LiveInterval *li,
+ SmallVectorImpl<MachineInstr*> *dead) {
DEBUG(dbgs() << "Shrink: " << *li << '\n');
assert(TargetRegisterInfo::isVirtualRegister(li->reg)
&& "Can't only shrink physical registers");
@@ -852,6 +853,10 @@ void LiveIntervals::shrinkToUses(LiveInterval *li) {
MachineInstr *MI = getInstructionFromIndex(VNI->def);
assert(MI && "No instruction defining live value");
MI->addRegisterDead(li->reg, tri_);
+ if (dead && MI->allDefsAreDead()) {
+ DEBUG(dbgs() << "All defs dead: " << *MI);
+ dead->push_back(MI);
+ }
}
}