mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-21 03:32:21 +00:00
Fix an iterator invalidation issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2cbdd27305
commit
97ca75e4bb
@ -751,11 +751,17 @@ bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) {
|
||||
// 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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user