[llvm-commits] [llvm] r66129 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
Evan Cheng
evan.cheng at apple.com
Wed Mar 4 19:34:27 PST 2009
Author: evancheng
Date: Wed Mar 4 21:34:26 2009
New Revision: 66129
URL: http://llvm.org/viewvc/llvm-project?rev=66129&view=rev
Log:
Fix how livein live intervals are handled. Previously it could end at MBB start. Sorry, no small test case possible.
Modified:
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=66129&r1=66128&r2=66129&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Mar 4 21:34:26 2009
@@ -684,11 +684,13 @@
getInstructionFromIndex(baseIndex) == 0)
baseIndex += InstrSlots::NUM;
unsigned end = baseIndex;
+ bool SeenDefUse = false;
while (mi != MBB->end()) {
if (mi->killsRegister(interval.reg, tri_)) {
DOUT << " killed";
end = getUseIndex(baseIndex) + 1;
+ SeenDefUse = true;
goto exit;
} else if (mi->modifiesRegister(interval.reg, tri_)) {
// Another instruction redefines the register before it is ever read.
@@ -697,19 +699,22 @@
// [defSlot(def), defSlot(def)+1)
DOUT << " dead";
end = getDefIndex(start) + 1;
+ SeenDefUse = true;
goto exit;
}
baseIndex += InstrSlots::NUM;
- while (baseIndex / InstrSlots::NUM < i2miMap_.size() &&
- getInstructionFromIndex(baseIndex) == 0)
- baseIndex += InstrSlots::NUM;
++mi;
+ if (mi != MBB->end()) {
+ while (baseIndex / InstrSlots::NUM < i2miMap_.size() &&
+ getInstructionFromIndex(baseIndex) == 0)
+ baseIndex += InstrSlots::NUM;
+ }
}
exit:
// Live-in register might not be used at all.
- if (end == MIIdx) {
+ if (!SeenDefUse) {
if (isAlias) {
DOUT << " dead";
end = getDefIndex(MIIdx) + 1;
More information about the llvm-commits
mailing list