diff options
author | Jay Foad <jay.foad@gmail.com> | 2011-06-21 10:02:43 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2011-06-21 10:02:43 +0000 |
commit | 25127ab1e4d1a68f26943c3a87c9cf26fca82e8f (patch) | |
tree | c92fd7fe8b97553bbc25e57de9b202c4f27e7d61 | |
parent | 4eb724ffdf4d863596aeb3b1b22f92f6f415e5a3 (diff) | |
download | bcm5719-llvm-25127ab1e4d1a68f26943c3a87c9cf26fca82e8f.tar.gz bcm5719-llvm-25127ab1e4d1a68f26943c3a87c9cf26fca82e8f.zip |
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
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopDeletion.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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<PHINode>(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; |