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 | 69254f67a54656ebf88fe854d0e8bf7fc58abda6 (patch) | |
tree | b5e053aa43767a6c1ee457d9bf46386ff7dcfd9f /lib/Transforms | |
parent | 80be2a26541f81374e8f1625b2d9f08de5b1f5d8 (diff) | |
download | external_llvm-69254f67a54656ebf88fe854d0e8bf7fc58abda6.zip external_llvm-69254f67a54656ebf88fe854d0e8bf7fc58abda6.tar.gz external_llvm-69254f67a54656ebf88fe854d0e8bf7fc58abda6.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133512 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopDeletion.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopDeletion.cpp b/lib/Transforms/Scalar/LoopDeletion.cpp index 753a558..f7f3298 100644 --- a/lib/Transforms/Scalar/LoopDeletion.cpp +++ b/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; |