[llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp
Chris Lattner
sabre at nondot.org
Sun Apr 8 18:19:50 PDT 2007
Changes in directory llvm/lib/CodeGen:
PrologEpilogInserter.cpp updated: 1.78 -> 1.79
---
Log message:
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
---
Diffs of the changes: (+9 -7)
PrologEpilogInserter.cpp | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.78 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.79
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.78 Sun Apr 8 19:46:10 2007
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Sun Apr 8 20:19:33 2007
@@ -498,20 +498,22 @@
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);
}
}
}
More information about the llvm-commits
mailing list