aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-09 01:19:33 +0000
committerChris Lattner <sabre@nondot.org>2007-04-09 01:19:33 +0000
commit0ebe9c132c6b9c74b334f0c7503e702b499575d5 (patch)
tree75e7213a6b889ffad229bfde9b497315a3c93b0d /lib/CodeGen/PrologEpilogInserter.cpp
parent599ded1a7f00365cffc2d3143759a9d621550eee (diff)
Fix a bug introduced with my previous patch, where it didn't correctly handle
instructions which replace themselves when FI's are rewritten (common on ppc). This fixes CodeGen/PowerPC/2006-10-17-ppc64-alloca.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--lib/CodeGen/PrologEpilogInserter.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index b76fa3f4eb..b6e909507a 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/lib/CodeGen/PrologEpilogInserter.cpp
@@ -498,20 +498,22 @@ void PEI::replaceFrameIndices(MachineFunction &Fn) {
for (MachineFunction::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) {
if (RS) RS->enterBasicBlock(BB);
- for (MachineBasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) {
- for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
- if (I->getOperand(i).isFrameIndex()) {
+ for (MachineBasicBlock::iterator I = BB->begin(); I != BB->end(); ) {
+ MachineInstr *MI = I++;
+ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i)
+ if (MI->getOperand(i).isFrameIndex()) {
// If this instruction has a FrameIndex operand, we need to use that
// target machine register info object to eliminate it.
- MRI.eliminateFrameIndex(I, RS);
+ MRI.eliminateFrameIndex(MI, RS);
// Revisit the instruction in full. Some instructions (e.g. inline
// asm instructions) can have multiple frame indices.
- e = I->getNumOperands();
- i = -1U;
+ --I;
+ MI = 0;
+ break;
}
// Update register states.
- if (RS) RS->forward(I);
+ if (RS && MI) RS->forward(MI);
}
}
}