mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
Fix an iterator invalidation problem in a "buggy" pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12468 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
835104c58e
commit
9d5968dd51
@ -44,7 +44,7 @@ namespace {
|
||||
|
||||
namespace {
|
||||
/// DeleteCalls - This pass is used to test bugpoint. It intentionally
|
||||
/// deletes all call instructions, "misoptimizing" the program.
|
||||
/// deletes some call instructions, "misoptimizing" the program.
|
||||
class DeleteCalls : public BasicBlockPass {
|
||||
bool runOnBasicBlock(BasicBlock &BB) {
|
||||
for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
|
||||
@ -52,6 +52,7 @@ namespace {
|
||||
if (!CI->use_empty())
|
||||
CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
|
||||
CI->getParent()->getInstList().erase(CI);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user