summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervals.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-01-13 22:26:14 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-01-13 22:26:14 +0000
commit0431621429b36220f275c30363950c735268942b (patch)
tree55c6f5775f8d7ab50bbc6c65d309483e62aec614 /llvm/lib/CodeGen/LiveIntervals.cpp
parentedf6c9d5a45a32b418898765ea79062cc3081f74 (diff)
downloadbcm5719-llvm-0431621429b36220f275c30363950c735268942b.tar.gz
bcm5719-llvm-0431621429b36220f275c30363950c735268942b.zip
Fix miscomputation of live intervals. The catch is that registers can
be dead at the defining instruction but can only be killed in subsequent ones. llvm-svn: 10833
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervals.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervals.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp
index 4929a56e691..acc32117c00 100644
--- a/llvm/lib/CodeGen/LiveIntervals.cpp
+++ b/llvm/lib/CodeGen/LiveIntervals.cpp
@@ -196,6 +196,21 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock* mbb,
unsigned start = getInstructionIndex(*mi);
unsigned end = start;
+ // register can be dead by the instruction defining it but it can
+ // only be killed by subsequent instructions
+
+ for (LiveVariables::killed_iterator
+ ki = lv_->dead_begin(*mi),
+ ke = lv_->dead_end(*mi);
+ ki != ke; ++ki) {
+ if (reg == ki->second) {
+ end = getInstructionIndex(ki->first) + 1;
+ DEBUG(std::cerr << " dead\n");
+ goto exit;
+ }
+ }
+ ++mi;
+
for (MachineBasicBlock::iterator e = mbb->end(); mi != e; ++mi) {
for (LiveVariables::killed_iterator
ki = lv_->dead_begin(*mi),
@@ -203,6 +218,7 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock* mbb,
ki != ke; ++ki) {
if (reg == ki->second) {
end = getInstructionIndex(ki->first) + 1;
+ DEBUG(std::cerr << " dead\n");
goto exit;
}
}
@@ -213,6 +229,7 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock* mbb,
ki != ke; ++ki) {
if (reg == ki->second) {
end = getInstructionIndex(ki->first) + 1;
+ DEBUG(std::cerr << " killed\n");
goto exit;
}
}
OpenPOWER on IntegriCloud