diff options
author | Owen Anderson <resistor@mac.com> | 2009-02-20 10:02:23 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-02-20 10:02:23 +0000 |
commit | 4cafbb58e2c54138f05b9857db4a098a15e914ca (patch) | |
tree | 660e0f5e73a85e7c1cc52bfaecbd44ea29a24e3a /lib/CodeGen/PreAllocSplitting.cpp | |
parent | 3b2c01723c2f7270e357f3b8502bb80572b3e644 (diff) |
Fix a crash in the pre-alloc splitter exposed by recent codegen changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65121 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PreAllocSplitting.cpp')
-rw-r--r-- | lib/CodeGen/PreAllocSplitting.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/PreAllocSplitting.cpp b/lib/CodeGen/PreAllocSplitting.cpp index ef2cfdb982..9e955bd696 100644 --- a/lib/CodeGen/PreAllocSplitting.cpp +++ b/lib/CodeGen/PreAllocSplitting.cpp @@ -224,6 +224,9 @@ PreAllocSplitting::findSpillPoint(MachineBasicBlock *MBB, MachineInstr *MI, if (RefsInMBB.empty() && !DefMI) { MachineBasicBlock::iterator MII = MBB->begin(); MachineBasicBlock::iterator EndPt = MI; + + if (MII == EndPt) return Pt; + do { ++MII; unsigned Index = LIs->getInstructionIndex(MII); @@ -303,6 +306,9 @@ PreAllocSplitting::findRestorePoint(MachineBasicBlock *MBB, MachineInstr *MI, if (RefsInMBB.empty() && LastIdx >= EndIdx) { MachineBasicBlock::iterator MII = MBB->getFirstTerminator(); MachineBasicBlock::iterator EndPt = MI; + + if (MII == EndPt) return Pt; + --MII; do { unsigned Index = LIs->getInstructionIndex(MII); |