aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-08-27 06:10:02 +0000
committerBill Wendling <isanbard@gmail.com>2011-08-27 06:10:02 +0000
commit884fb72f155b2ca0c26de7d12ec12f4778932831 (patch)
tree5006eba215f5c775464f7cad5963d86b483fe75e /lib
parent234e43a88859c7e0bb6639573deaa3d412ac118c (diff)
downloadexternal_llvm-884fb72f155b2ca0c26de7d12ec12f4778932831.tar.gz
external_llvm-884fb72f155b2ca0c26de7d12ec12f4778932831.tar.bz2
external_llvm-884fb72f155b2ca0c26de7d12ec12f4778932831.zip
Only delete instructions once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/AutoUpgrade.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp
index 1a8f6b99dd..7b0b34ed89 100644
--- a/lib/VMCore/AutoUpgrade.cpp
+++ b/lib/VMCore/AutoUpgrade.cpp
@@ -389,7 +389,7 @@ void llvm::UpgradeExceptionHandling(Module *M) {
// 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 @@ void llvm::UpgradeExceptionHandling(Module *M) {
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();
}