Don't increment invalid iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42178 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2007-09-20 23:01:50 +00:00
parent d7944ca61c
commit d15dd8c525

View File

@ -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();
}