[PATCH] D52902: [WebAssembly] Don't modify preds/succs iterators while erasing from them
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 4 14:05:27 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL343814: [WebAssembly] Don't modify preds/succs iterators while erasing from them (authored by aheejin, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D52902
Files:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
@@ -91,12 +91,15 @@
SmallVector<MachineBasicBlock *, 8> WL(MBBs.begin(), MBBs.end());
while (!WL.empty()) {
MachineBasicBlock *MBB = WL.pop_back_val();
- for (auto *Pred : MBB->predecessors())
+ SmallVector<MachineBasicBlock *, 4> Preds(MBB->pred_begin(),
+ MBB->pred_end());
+ for (auto *Pred : Preds)
Pred->removeSuccessor(MBB);
- for (auto *Succ : MBB->successors()) {
- WL.push_back(Succ);
+ SmallVector<MachineBasicBlock *, 4> Succs(MBB->succ_begin(),
+ MBB->succ_end());
+ WL.append(MBB->succ_begin(), MBB->succ_end());
+ for (auto *Succ : Succs)
MBB->removeSuccessor(Succ);
- }
MBB->eraseFromParent();
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52902.168374.patch
Type: text/x-patch
Size: 1038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181004/c58ffec4/attachment.bin>
More information about the llvm-commits
mailing list