From 57b0b312576f5edd4fa3f36ffcd46dc519b2317a Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 20 Sep 2007 23:01:50 +0000 Subject: [PATCH] Don't increment invalid iterator. llvm-svn: 42178 --- lib/Transforms/Scalar/LoopIndexSplit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index d30f18d91b6..9e2f11bb6de 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -928,8 +928,9 @@ void LoopIndexSplit::removeBlocks(BasicBlock *DeadBB, Loop *LP, while (!WorkList.empty()) { BasicBlock *BB = WorkList.back(); WorkList.pop_back(); for(BasicBlock::iterator BBI = BB->begin(), BBE = BB->end(); - BBI != BBE; ++BBI) { + BBI != BBE; ) { Instruction *I = BBI; + ++BBI; I->replaceAllUsesWith(UndefValue::get(I->getType())); I->eraseFromParent(); }