mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 21:29:41 +00:00
Only delete instructions once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138700 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
234e43a888
commit
884fb72f15
@ -389,7 +389,7 @@ void llvm::UpgradeExceptionHandling(Module *M) {
|
|||||||
|
|
||||||
// This map stores the slots where the exception object and selector value are
|
// This map stores the slots where the exception object and selector value are
|
||||||
// stored within a function.
|
// stored within a function.
|
||||||
SmallVector<Instruction*, 32> DeadInsts;
|
SmallPtrSet<Instruction*, 32> DeadInsts;
|
||||||
DenseMap<Function*, std::pair<Value*, Value*> > FnToLPadSlotMap;
|
DenseMap<Function*, std::pair<Value*, Value*> > FnToLPadSlotMap;
|
||||||
for (Module::iterator
|
for (Module::iterator
|
||||||
I = M->begin(), E = M->end(); I != E; ++I) {
|
I = M->begin(), E = M->end(); I != E; ++I) {
|
||||||
@ -439,14 +439,15 @@ void llvm::UpgradeExceptionHandling(Module *M) {
|
|||||||
Exn->replaceAllUsesWith(LPExn);
|
Exn->replaceAllUsesWith(LPExn);
|
||||||
Sel->replaceAllUsesWith(LPSel);
|
Sel->replaceAllUsesWith(LPSel);
|
||||||
|
|
||||||
DeadInsts.push_back(Exn);
|
DeadInsts.insert(Exn);
|
||||||
DeadInsts.push_back(Sel);
|
DeadInsts.insert(Sel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the dead instructions.
|
// Remove the dead instructions.
|
||||||
while (!DeadInsts.empty()) {
|
for (SmallPtrSet<Instruction*, 32>::iterator
|
||||||
Instruction *Inst = DeadInsts.pop_back_val();
|
I = DeadInsts.begin(), E = DeadInsts.end(); I != E; ++I) {
|
||||||
|
Instruction *Inst = *I;
|
||||||
Inst->eraseFromParent();
|
Inst->eraseFromParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user