From 040d65920624c671e1df37b44761b1314989b26a Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Tue, 28 Jun 2011 01:18:58 +0000 Subject: Fix a bad iterator dereference that Evan uncovered. llvm-svn: 133978 --- llvm/lib/CodeGen/SplitKit.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/SplitKit.cpp') diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index 18f315ab20d..55b1114b5b2 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -76,12 +76,14 @@ SlotIndex SplitAnalysis::computeLastSplitPoint(unsigned Num) { return LSP.first; // There may not be a call instruction (?) in which case we ignore LPad. LSP.second = LSP.first; - for (MachineBasicBlock::const_iterator I = FirstTerm, E = MBB->begin(); - I != E; --I) + for (MachineBasicBlock::const_iterator I = MBB->end(), E = MBB->begin(); + I != E;) { + --I; if (I->getDesc().isCall()) { LSP.second = LIS.getInstructionIndex(I); break; } + } } // If CurLI is live into a landing pad successor, move the last split point -- cgit v1.2.3