[llvm-commits] [llvm] r67304 - /llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
Chris Lattner
sabre at nondot.org
Thu Mar 19 10:15:45 PDT 2009
Author: lattner
Date: Thu Mar 19 12:15:43 2009
New Revision: 67304
URL: http://llvm.org/viewvc/llvm-project?rev=67304&view=rev
Log:
Fix PEI to not walk off the start of a block when an updated instruction
is the first in its block. This is PR3842.
Modified:
llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=67304&r1=67303&r2=67304&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original)
+++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Thu Mar 19 12:15:43 2009
@@ -533,11 +533,15 @@
SPAdj += Size;
- MachineBasicBlock::iterator PrevI = prior(I);
+ MachineBasicBlock::iterator PrevI = BB->end();
+ if (I != BB->begin()) PrevI = prior(I);
TRI.eliminateCallFramePseudoInstr(Fn, *BB, I);
// Visit the instructions created by eliminateCallFramePseudoInstr().
- I = next(PrevI);
+ if (PrevI == BB->end())
+ I = BB->begin(); // The replaced instr was the first in the block.
+ else
+ I = next(PrevI);
continue;
}
More information about the llvm-commits
mailing list