mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
Fix a regression from this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040308/013095.html Basically, this patch only updated the immediate dominatees of the header node to tell them that the preheader also dominated them. In practice, ALL dominatees of the header node are also dominated by the preheader. This fixes: LoopSimplify/2004-03-15-IncorrectDomUpdate. and PR293 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12434 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
339c50873d
commit
85ebd541fa
@ -312,31 +312,28 @@ void LoopSimplify::InsertPreheaderForLoop(Loop *L) {
|
||||
|
||||
DominatorSet &DS = getAnalysis<DominatorSet>(); // Update dominator info
|
||||
DominatorTree &DT = getAnalysis<DominatorTree>();
|
||||
DominatorTree::Node *HeaderDTNode = DT.getNode(Header);
|
||||
|
||||
|
||||
// Update the dominator tree information.
|
||||
// The immediate dominator of the preheader is the immediate dominator of
|
||||
// the old header.
|
||||
DominatorTree::Node *PHDomTreeNode =
|
||||
DT.createNewNode(NewBB, DT.getNode(Header)->getIDom());
|
||||
|
||||
// Change the header node so that PNHode is the new immediate dominator
|
||||
DT.changeImmediateDominator(DT.getNode(Header), PHDomTreeNode);
|
||||
|
||||
{
|
||||
// The blocks that dominate NewBB are the blocks that dominate Header,
|
||||
// minus Header, plus NewBB.
|
||||
DominatorSet::DomSetType DomSet = DS.getDominators(Header);
|
||||
DomSet.insert(NewBB); // We dominate ourself
|
||||
DomSet.erase(Header); // Header does not dominate us...
|
||||
DS.addBasicBlock(NewBB, DomSet);
|
||||
|
||||
// The newly created basic block dominates all nodes dominated by Header.
|
||||
for (DominatorTree::Node::iterator I = HeaderDTNode->begin(),
|
||||
E = HeaderDTNode->end(); I != E; ++I)
|
||||
DS.addDominator((*I)->getBlock(), NewBB);
|
||||
}
|
||||
|
||||
{ // Update the dominator tree information.
|
||||
// The immediate dominator of the preheader is the immediate dominator of
|
||||
// the old header.
|
||||
//
|
||||
DominatorTree::Node *PHNode =
|
||||
DT.createNewNode(NewBB, HeaderDTNode->getIDom());
|
||||
|
||||
// Change the header node so that PNHode is the new immediate dominator
|
||||
DT.changeImmediateDominator(HeaderDTNode, PHNode);
|
||||
for (df_iterator<DominatorTree::Node*> DFI = df_begin(PHDomTreeNode),
|
||||
E = df_end(PHDomTreeNode); DFI != E; ++DFI)
|
||||
DS.addDominator((*DFI)->getBlock(), NewBB);
|
||||
}
|
||||
|
||||
// Update immediate dominator information if we have it...
|
||||
|
Loading…
x
Reference in New Issue
Block a user