From f13820148bbf9866376e53c9b6930d35b8da699a Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Fri, 20 Feb 2009 10:02:23 +0000 Subject: Fix a crash in the pre-alloc splitter exposed by recent codegen changes. llvm-svn: 65121 --- llvm/lib/CodeGen/PreAllocSplitting.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/CodeGen/PreAllocSplitting.cpp b/llvm/lib/CodeGen/PreAllocSplitting.cpp index ef2cfdb9828..9e955bd6969 100644 --- a/llvm/lib/CodeGen/PreAllocSplitting.cpp +++ b/llvm/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); -- cgit v1.2.3