Fix an iterator invalidation problem in a "buggy" pass
authorChris Lattner <sabre@nondot.org>
Wed, 17 Mar 2004 17:29:08 +0000 (17:29 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 17 Mar 2004 17:29:08 +0000 (17:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12468 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/TestPasses.cpp

index ee2c0d7248310c4a65196ae366ae81d1d32af6cf..1a58e60804bd5037efe5aaf1080039f317716202 100644 (file)
@@ -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;
     }