mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5655 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8ac33045d1
commit
69269ac203
@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user