[llvm-commits] [llvm] r143018 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp

Bill Wendling isanbard at gmail.com
Wed Oct 26 00:16:18 PDT 2011


Author: void
Date: Wed Oct 26 02:16:18 2011
New Revision: 143018

URL: http://llvm.org/viewvc/llvm-project?rev=143018&view=rev
Log:
Use a worklist to prevent the iterator from becoming invalidated because of the 'removeSuccessor' call. Noticed in a Release+Asserts+Check buildbot.

Modified:
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=143018&r1=143017&r2=143018&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Oct 26 02:16:18 2011
@@ -5996,9 +5996,10 @@
 
     // Remove the landing pad successor from the invoke block and replace it
     // with the new dispatch block.
-    for (MachineBasicBlock::succ_iterator
-           SI = BB->succ_begin(), SE = BB->succ_end(); SI != SE; ++SI) {
-      MachineBasicBlock *SMBB = *SI;
+    SmallVector<MachineBasicBlock*, 4> Successors(BB->succ_begin(),
+                                                  BB->succ_end());
+    while (!Successors.empty()) {
+      MachineBasicBlock *SMBB = Successors.pop_back_val();
       if (SMBB->isLandingPad()) {
         BB->removeSuccessor(SMBB);
         MBBLPads.push_back(SMBB);





More information about the llvm-commits mailing list