summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-17 20:37:07 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-17 20:37:07 +0000
commit6a3dbd3b25bbc99bd1a233d6a74ddea3493ba6ac (patch)
tree512a2f340823e0cb054136093b13d679f6200e6b /lib/CodeGen/LiveIntervalAnalysis.cpp
parentc74513d1b6e2f6c91533a23ebbdc47a6f1dfcc0c (diff)
downloadllvm-6a3dbd3b25bbc99bd1a233d6a74ddea3493ba6ac.tar.gz
llvm-6a3dbd3b25bbc99bd1a233d6a74ddea3493ba6ac.tar.bz2
llvm-6a3dbd3b25bbc99bd1a233d6a74ddea3493ba6ac.tar.xz
Dead code elimination may separate the live interval into multiple connected components.
I have convinced myself that it can only happen when a phi value dies. When it happens, allocate new virtual registers for the components. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127827 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index f2bf917201..c47c839748 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -746,7 +746,7 @@ 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,
+bool LiveIntervals::shrinkToUses(LiveInterval *li,
SmallVectorImpl<MachineInstr*> *dead) {
DEBUG(dbgs() << "Shrink: " << *li << '\n');
assert(TargetRegisterInfo::isVirtualRegister(li->reg)
@@ -835,6 +835,7 @@ void LiveIntervals::shrinkToUses(LiveInterval *li,
}
// Handle dead values.
+ bool CanSeparate = false;
for (LiveInterval::vni_iterator I = li->vni_begin(), E = li->vni_end();
I != E; ++I) {
VNInfo *VNI = *I;
@@ -848,6 +849,8 @@ void LiveIntervals::shrinkToUses(LiveInterval *li,
// This is a dead PHI. Remove it.
VNI->setIsUnused(true);
NewLI.removeRange(*LII);
+ DEBUG(dbgs() << "Dead PHI at " << VNI->def << " may separate interval\n");
+ CanSeparate = true;
} else {
// This is a dead def. Make sure the instruction knows.
MachineInstr *MI = getInstructionFromIndex(VNI->def);
@@ -863,6 +866,7 @@ void LiveIntervals::shrinkToUses(LiveInterval *li,
// Move the trimmed ranges back.
li->ranges.swap(NewLI.ranges);
DEBUG(dbgs() << "Shrunk: " << *li << '\n');
+ return CanSeparate;
}