diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-03-05 03:34:26 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-03-05 03:34:26 +0000 |
commit | 1e16ae4713d647ab8fe267d1ab3c2028f9a19fbf (patch) | |
tree | d4398f78ed58a5f6be73822751d922d7713ecd47 /lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | b7a9e3e8585cc3bbdc393ea0ba95d02dd84a907e (diff) | |
download | external_llvm-1e16ae4713d647ab8fe267d1ab3c2028f9a19fbf.zip external_llvm-1e16ae4713d647ab8fe267d1ab3c2028f9a19fbf.tar.gz external_llvm-1e16ae4713d647ab8fe267d1ab3c2028f9a19fbf.tar.bz2 |
Fix how livein live intervals are handled. Previously it could end at MBB start. Sorry, no small test case possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66129 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index 985a3fa..c70cbb4 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -684,11 +684,13 @@ void LiveIntervals::handleLiveInRegister(MachineBasicBlock *MBB, 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 @@ void LiveIntervals::handleLiveInRegister(MachineBasicBlock *MBB, // [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; |