From 9a8238e4777c63b6b1d983e48b2893b392bdd030 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 17 Mar 2004 17:29:08 +0000 Subject: [PATCH] Fix an iterator invalidation problem in a "buggy" pass llvm-svn: 12468 --- tools/bugpoint/TestPasses.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/bugpoint/TestPasses.cpp b/tools/bugpoint/TestPasses.cpp index ee2c0d72483..1a58e60804b 100644 --- a/tools/bugpoint/TestPasses.cpp +++ b/tools/bugpoint/TestPasses.cpp @@ -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; }