diff options
author | Chris Lattner <sabre@nondot.org> | 2003-02-27 21:50:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-02-27 21:50:19 +0000 |
commit | 4e2fbfb4c3051574f360bf5258a0c1d4d4794b5c (patch) | |
tree | a045e8c5ab6adca23229be012eb90d8dc50e8bcd /llvm/lib/Transforms | |
parent | 209a688b55060110e5b9bc0773b1d2368aa3c1bf (diff) | |
download | bcm5719-llvm-4e2fbfb4c3051574f360bf5258a0c1d4d4794b5c.tar.gz bcm5719-llvm-4e2fbfb4c3051574f360bf5258a0c1d4d4794b5c.zip |
* Don't forget to update Loop information!
* Remove bogus assertion: there may be a single outside predecessor and
still need a new loop-preheader if the predecessor has multiple
successors. See bug: LICM/2003-02-27-PreheaderProblem.ll
llvm-svn: 5655
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopSimplify.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopSimplify.cpp b/llvm/lib/Transforms/Scalar/LoopSimplify.cpp index 33dab597e67..dc9df6aa390 100644 --- a/llvm/lib/Transforms/Scalar/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/LoopSimplify.cpp @@ -179,8 +179,6 @@ void Preheaders::InsertPreheaderForLoop(Loop *L) { if (!L->contains(*PI)) // Coming in from outside the loop? OutsideBlocks.push_back(*PI); // Keep track of it... - assert(OutsideBlocks.size() != 1 && "Loop already has a preheader!"); - // Split out the loop pre-header BasicBlock *NewBB = SplitBlockPredecessors(Header, ".preheader", OutsideBlocks); @@ -281,6 +279,11 @@ void Preheaders::RewriteLoopExitBlock(Loop *L, BasicBlock *Exit) { BasicBlock *NewBB = SplitBlockPredecessors(Exit, ".loopexit", LoopBlocks); + // Update Loop Information - we know that the new block will be in the parent + // loop of L. + if (Loop *Parent = L->getParentLoop()) + Parent->addBasicBlockToLoop(NewBB, getAnalysis<LoopInfo>()); + // Update dominator information... The blocks that dominate NewBB are the // intersection of the dominators of predecessors, plus the block itself. // The newly created basic block does not dominate anything except itself. @@ -363,6 +366,5 @@ void Preheaders::RewriteLoopExitBlock(Loop *L, BasicBlock *Exit) { } } } - } } |