diff options
| author | Dan Gohman <gohman@apple.com> | 2009-09-09 18:18:18 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-09-09 18:18:18 +0000 |
| commit | ec4557f324a4264986f8544cf84c392bd26074c6 (patch) | |
| tree | ccf99895d5b899b46d3d8ebb4b0bfc32b2a24fe4 /llvm/lib/Transforms/Scalar | |
| parent | 3cb19a156ded1e2fcc6f259c94bd7272ed2a1bef (diff) | |
| download | bcm5719-llvm-ec4557f324a4264986f8544cf84c392bd26074c6.tar.gz bcm5719-llvm-ec4557f324a4264986f8544cf84c392bd26074c6.zip | |
Fix SplitCriticalEdge to properly update LCSSA form when splitting a
loop exit edge -- new PHIs may be needed not only for the additional
splits that are made to preserve LoopSimplify form, but also for the
original split. Factor out the code that inserts new PHIs so that it
can be used for both. Remove LoopRotation.cpp's code for manually
updating LCSSA form, as it is now redundant. This fixes PR4934.
llvm-svn: 81363
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopRotation.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp index 4b10d1006e7..ca394bdc46a 100644 --- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp +++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp @@ -542,22 +542,7 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) { // Preserve canonical loop form, which means Exit block should // have only one predecessor. - BasicBlock *NExit = SplitEdge(L->getLoopLatch(), Exit, this); - - // Preserve LCSSA. - for (BasicBlock::iterator I = Exit->begin(); - (PN = dyn_cast<PHINode>(I)); ++I) { - unsigned N = PN->getNumIncomingValues(); - for (unsigned index = 0; index != N; ++index) - if (PN->getIncomingBlock(index) == NExit) { - PHINode *NewPN = PHINode::Create(PN->getType(), PN->getName(), - NExit->begin()); - NewPN->addIncoming(PN->getIncomingValue(index), L->getLoopLatch()); - PN->setIncomingValue(index, NewPN); - PN->setIncomingBlock(index, NExit); - break; - } - } + SplitEdge(L->getLoopLatch(), Exit, this); assert(NewHeader && L->getHeader() == NewHeader && "Invalid loop header after loop rotation"); |

