summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-11-15 20:54:11 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-11-15 20:54:11 +0000
commit12ea213de9bcdf1f312a23bbb4db587f058bdd09 (patch)
tree1ca49e0a7f15f9255d9e3033906da74f18f66c7a /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
parent70ec52896e21f910785742e6269fac191e29eb86 (diff)
downloadbcm5719-llvm-12ea213de9bcdf1f312a23bbb4db587f058bdd09.tar.gz
bcm5719-llvm-12ea213de9bcdf1f312a23bbb4db587f058bdd09.zip
A register def can be partially dead when the whole register has use(s) but a subreg does not.
llvm-svn: 31760
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 730ad239141..03f38602aee 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -575,7 +575,6 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock *MBB,
// A physical register cannot be live across basic block, so its
// lifetime must end somewhere in its defining basic block.
DEBUG(std::cerr << "\t\tregister: "; printRegName(interval.reg));
- typedef LiveVariables::killed_iterator KillIter;
unsigned baseIndex = MIIdx;
unsigned start = getDefIndex(baseIndex);
@@ -599,6 +598,14 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock *MBB,
DEBUG(std::cerr << " killed");
end = getUseIndex(baseIndex) + 1;
goto exit;
+ } else if (lv_->ModifiesRegister(mi, interval.reg)) {
+ // Another instruction redefines the register before it is ever read.
+ // Then the register is essentially dead at the instruction that defines
+ // it. Hence its interval is:
+ // [defSlot(def), defSlot(def)+1)
+ DEBUG(std::cerr << " dead");
+ end = getDefIndex(start) + 1;
+ goto exit;
}
}
OpenPOWER on IntegriCloud