summaryrefslogtreecommitdiffstats
path: root/llvm
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
commit032c60c1a032c17b0a5afb541e06fd4118196c78 (patch)
treed799cc24e651a044648497d8125e07024991b9f6 /llvm
parent2f92d2cdae08cc3e4f6ed903ca6b85c6dfe23c6a (diff)
downloadbcm5719-llvm-032c60c1a032c17b0a5afb541e06fd4118196c78.tar.gz
bcm5719-llvm-032c60c1a032c17b0a5afb541e06fd4118196c78.zip
Only delete instructions once.
llvm-svn: 138700
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/VMCore/AutoUpgrade.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/AutoUpgrade.cpp b/llvm/lib/VMCore/AutoUpgrade.cpp
index 1a8f6b99dd7..7b0b34ed89f 100644
--- a/llvm/lib/VMCore/AutoUpgrade.cpp
+++ b/llvm/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();
}
OpenPOWER on IntegriCloud