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
This commit is contained in:
Alkis Evlogimenos 2004-01-13 22:26:14 +00:00
parent edf6c9d5a4
commit 0431621429
1 changed files with 17 additions and 0 deletions

View File

@ -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;
}
}