Skip to content

Commit 425726d

Browse files
committed
Fix an iterator invalidation problem in a "buggy" pass
llvm-svn: 12468
1 parent 2820235 commit 425726d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/tools/bugpoint/TestPasses.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ namespace {
4444

4545
namespace {
4646
/// DeleteCalls - This pass is used to test bugpoint. It intentionally
47-
/// deletes all call instructions, "misoptimizing" the program.
47+
/// deletes some call instructions, "misoptimizing" the program.
4848
class DeleteCalls : public BasicBlockPass {
4949
bool runOnBasicBlock(BasicBlock &BB) {
5050
for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
5151
if (CallInst *CI = dyn_cast<CallInst>(I)) {
5252
if (!CI->use_empty())
5353
CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
5454
CI->getParent()->getInstList().erase(CI);
55+
break;
5556
}
5657
return false;
5758
}

0 commit comments

Comments
 (0)