summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-19 17:15:43 +0000
committerChris Lattner <sabre@nondot.org>2009-03-19 17:15:43 +0000
commit58bd3dccf97a986492e56fe70677881698524c3f (patch)
tree349de8908f2d21e43fa4159a5168b13bf7ebb109 /llvm/lib
parent820846503697622af5ea294f6b18cd28915c7f49 (diff)
downloadbcm5719-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')
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp8
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;
}
OpenPOWER on IntegriCloud