[llvm-commits] [llvm] r138700 - /llvm/trunk/lib/VMCore/AutoUpgrade.cpp

Bill Wendling isanbard at gmail.com
Fri Aug 26 23:10:02 PDT 2011


Author: void
Date: Sat Aug 27 01:10:02 2011
New Revision: 138700

URL: http://llvm.org/viewvc/llvm-project?rev=138700&view=rev
Log:
Only delete instructions once.

Modified:
    llvm/trunk/lib/VMCore/AutoUpgrade.cpp

Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=138700&r1=138699&r2=138700&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Sat Aug 27 01:10:02 2011
@@ -389,7 +389,7 @@
 
   // This map stores the slots where the exception object and selector value are
   // stored within a function.
-  SmallVector<Instruction*, 32> DeadInsts;
+  SmallPtrSet<Instruction*, 32> DeadInsts;
   DenseMap<Function*, std::pair<Value*, Value*> > FnToLPadSlotMap;
   for (Module::iterator
          I = M->begin(), E = M->end(); I != E; ++I) {
@@ -439,14 +439,15 @@
       Exn->replaceAllUsesWith(LPExn);
       Sel->replaceAllUsesWith(LPSel);
 
-      DeadInsts.push_back(Exn);
-      DeadInsts.push_back(Sel);
+      DeadInsts.insert(Exn);
+      DeadInsts.insert(Sel);
     }
   }
 
   // Remove the dead instructions.
-  while (!DeadInsts.empty()) {
-    Instruction *Inst = DeadInsts.pop_back_val();
+  for (SmallPtrSet<Instruction*, 32>::iterator
+         I = DeadInsts.begin(), E = DeadInsts.end(); I != E; ++I) {
+    Instruction *Inst = *I;
     Inst->eraseFromParent();
   }
 





More information about the llvm-commits mailing list