diff options
author | Owen Anderson <resistor@mac.com> | 2008-05-06 20:55:16 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-05-06 20:55:16 +0000 |
commit | df663b80f294a2f8442f29c1bfe6832414bcf5f1 (patch) | |
tree | 9cb39d18cd116b506a0da5dca20b455537443d08 /lib | |
parent | fb37048b3f4adbfe22f1488f27335de62604eb73 (diff) | |
download | external_llvm-df663b80f294a2f8442f29c1bfe6832414bcf5f1.zip external_llvm-df663b80f294a2f8442f29c1bfe6832414bcf5f1.tar.gz external_llvm-df663b80f294a2f8442f29c1bfe6832414bcf5f1.tar.bz2 |
We need to update PHIs containing the exiting block, not the exit block. We really should come up with better names for these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50770 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/LoopDeletion.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/LoopDeletion.cpp b/lib/Transforms/Scalar/LoopDeletion.cpp index 763060c..1ea2f6a 100644 --- a/lib/Transforms/Scalar/LoopDeletion.cpp +++ b/lib/Transforms/Scalar/LoopDeletion.cpp @@ -192,8 +192,9 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) { return false; // Now that we know the removal is safe, remove the loop by changing the - // branch from the preheader to go to the single exiting block. + // branch from the preheader to go to the single exit block. BasicBlock* exitBlock = exitBlocks[0]; + BasicBlock* exitingBlock = exitingBlocks[0]; // Because we're deleting a large chunk of code at once, the sequence in which // we remove things is very important to avoid invalidation issues. Don't @@ -218,7 +219,7 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) { // the preheader instead of the exiting block. BasicBlock::iterator BI = exitBlock->begin(); while (PHINode* P = dyn_cast<PHINode>(BI)) { - P->replaceUsesOfWith(exitBlock, preheader); + P->replaceUsesOfWith(exitingBlock, preheader); BI++; } @@ -253,8 +254,12 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) { // NOTE: This iteration is safe because erasing the block does not remove its // entry from the loop's block list. We do that in the next section. for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end(); - LI != LE; ++LI) + LI != LE; ++LI) { + for (Value::use_iterator UI = (*LI)->use_begin(), UE = (*LI)->use_end(); + UI != UE; ++UI) + (*UI)->dump(); (*LI)->eraseFromParent(); + } // Finally, the blocks from loopinfo. This has to happen late because // otherwise our loop iterators won't work. |