From 25127ab1e4d1a68f26943c3a87c9cf26fca82e8f Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Tue, 21 Jun 2011 10:02:43 +0000 Subject: Don't use PN->replaceUsesOfWith() to change a PHINode's incoming blocks, because it won't work after my phi operand changes, because the incoming blocks will no longer be Uses. llvm-svn: 133512 --- llvm/lib/Transforms/Scalar/LoopDeletion.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp index 753a558cfe8..f7f32981baa 100644 --- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp @@ -190,7 +190,9 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) { BasicBlock* exitingBlock = exitingBlocks[0]; BasicBlock::iterator BI = exitBlock->begin(); while (PHINode* P = dyn_cast(BI)) { - P->replaceUsesOfWith(exitingBlock, preheader); + int j = P->getBasicBlockIndex(exitingBlock); + assert(j >= 0 && "Can't find exiting block in exit block's phi node!"); + P->setIncomingBlock(j, preheader); for (unsigned i = 1; i < exitingBlocks.size(); ++i) P->removeIncomingValue(exitingBlocks[i]); ++BI; -- cgit v1.2.3