forked from OSchip/llvm-project
Use a worklist to prevent the iterator from becoming invalidated because of the 'removeSuccessor' call. Noticed in a Release+Asserts+Check buildbot.
llvm-svn: 143018
This commit is contained in:
parent
ae1bab56d9
commit
1414bc5a14
|
@ -5996,9 +5996,10 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
|
||||||
|
|
||||||
// Remove the landing pad successor from the invoke block and replace it
|
// Remove the landing pad successor from the invoke block and replace it
|
||||||
// with the new dispatch block.
|
// with the new dispatch block.
|
||||||
for (MachineBasicBlock::succ_iterator
|
SmallVector<MachineBasicBlock*, 4> Successors(BB->succ_begin(),
|
||||||
SI = BB->succ_begin(), SE = BB->succ_end(); SI != SE; ++SI) {
|
BB->succ_end());
|
||||||
MachineBasicBlock *SMBB = *SI;
|
while (!Successors.empty()) {
|
||||||
|
MachineBasicBlock *SMBB = Successors.pop_back_val();
|
||||||
if (SMBB->isLandingPad()) {
|
if (SMBB->isLandingPad()) {
|
||||||
BB->removeSuccessor(SMBB);
|
BB->removeSuccessor(SMBB);
|
||||||
MBBLPads.push_back(SMBB);
|
MBBLPads.push_back(SMBB);
|
||||||
|
|
Loading…
Reference in New Issue