mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Fix major bugs in dominator set & tree information updating
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3975 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
934487a9cc
commit
4d01892e36
@ -153,14 +153,18 @@ void Preheaders::InsertPreheaderForLoop(Loop *L) {
|
||||
|
||||
// Update dominator information if it is around...
|
||||
if (DominatorSet *DS = getAnalysisToUpdate<DominatorSet>()) {
|
||||
// We need to add information about the fact that NewBB dominates Header.
|
||||
DS->addDominator(Header, NewBB);
|
||||
|
||||
// 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 (Function::iterator I = Header->getParent()->begin(),
|
||||
E = Header->getParent()->end(); I != E; ++I)
|
||||
if (DS->dominates(Header, I))
|
||||
DS->addDominator(I, NewBB);
|
||||
}
|
||||
|
||||
// Update immediate dominator information if we have it...
|
||||
@ -178,11 +182,10 @@ void Preheaders::InsertPreheaderForLoop(Loop *L) {
|
||||
// the old header.
|
||||
//
|
||||
DominatorTree::Node *HeaderNode = DT->getNode(Header);
|
||||
DominatorTree::Node *PHNode = DT->createNewNode(NewBB, HeaderNode);
|
||||
DominatorTree::Node *PHNode = DT->createNewNode(NewBB,
|
||||
HeaderNode->getIDom());
|
||||
|
||||
// Change the header node so that PNHode is the new immediate dominator
|
||||
DT->changeImmediateDominator(HeaderNode, PHNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user