[llvm-commits] [llvm] r46263 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
Owen Anderson
resistor at mac.com
Tue Jan 22 15:58:55 PST 2008
Author: resistor
Date: Tue Jan 22 17:58:54 2008
New Revision: 46263
URL: http://llvm.org/viewvc/llvm-project?rev=46263&view=rev
Log:
Fix an iterator invalidation issue.
Modified:
llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=46263&r1=46262&r2=46263&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Jan 22 17:58:54 2008
@@ -751,11 +751,17 @@
// FIXME: Insert last-minute copies
// Remove PHIs
- for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
+ std::vector<MachineInstr*> phis;
+ for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) {
for (MachineBasicBlock::iterator BI = I->begin(), BE = I->end();
BI != BE; ++BI)
if (BI->getOpcode() == TargetInstrInfo::PHI)
- BI->eraseFromParent();
+ phis.push_back(BI);
+ }
+
+ for (std::vector<MachineInstr*>::iterator I = phis.begin(), E = phis.end();
+ I != E; ++I)
+ (*I)->eraseFromParent();
return false;
}
More information about the llvm-commits
mailing list