mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Fix an iterator invalidation issue.
llvm-svn: 46263
This commit is contained in:
parent
d436c2e724
commit
c354bbc085
@ -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…
Reference in New Issue
Block a user