diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-19 17:15:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-19 17:15:43 +0000 |
commit | 5e6345bde0f3a6405ec1ea852f1e5e5df8642f9c (patch) | |
tree | 640d2db7092426390ae30f0cca496fd38c89da73 /lib/CodeGen/PrologEpilogInserter.cpp | |
parent | bf5836b075a7fdd680e7c43134237bdef65643cf (diff) | |
download | external_llvm-5e6345bde0f3a6405ec1ea852f1e5e5df8642f9c.zip external_llvm-5e6345bde0f3a6405ec1ea852f1e5e5df8642f9c.tar.gz external_llvm-5e6345bde0f3a6405ec1ea852f1e5e5df8642f9c.tar.bz2 |
Fix PEI to not walk off the start of a block when an updated instruction
is the first in its block. This is PR3842.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r-- | lib/CodeGen/PrologEpilogInserter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index 39f9613..ab63f49 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -533,11 +533,15 @@ void PEI::replaceFrameIndices(MachineFunction &Fn) { 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; } |