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 | 58bd3dccf97a986492e56fe70677881698524c3f (patch) | |
| tree | 349de8908f2d21e43fa4159a5168b13bf7ebb109 /llvm/lib/CodeGen | |
| parent | 820846503697622af5ea294f6b18cd28915c7f49 (diff) | |
| download | bcm5719-llvm-58bd3dccf97a986492e56fe70677881698524c3f.tar.gz bcm5719-llvm-58bd3dccf97a986492e56fe70677881698524c3f.zip | |
Fix PEI to not walk off the start of a block when an updated instruction
is the first in its block. This is PR3842.
llvm-svn: 67304
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/PrologEpilogInserter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index 39f96133bd1..ab63f4933ff 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/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; } |

