mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Check A dominates B and vise versa first while searching for nearest
common dominator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37559 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -387,12 +387,12 @@ BasicBlock *DominatorTreeBase::findNearestCommonDominator(BasicBlock *A,
|
|||||||
|
|
||||||
DomTreeNode *NodeB = getNode(B);
|
DomTreeNode *NodeB = getNode(B);
|
||||||
|
|
||||||
// If B immediately dominates A then B is nearest common dominator.
|
// If B dominates A then B is nearest common dominator.
|
||||||
if (NodeA->getIDom() == NodeB)
|
if (dominates(B,A))
|
||||||
return B;
|
return B;
|
||||||
|
|
||||||
// If A immediately dominates B then A is nearest common dominator.
|
// If A dominates B then A is nearest common dominator.
|
||||||
if (NodeB->getIDom() == NodeA)
|
if (dominates(A,B))
|
||||||
return A;
|
return A;
|
||||||
|
|
||||||
// Collect NodeA dominators set.
|
// Collect NodeA dominators set.
|
||||||
@@ -404,10 +404,6 @@ BasicBlock *DominatorTreeBase::findNearestCommonDominator(BasicBlock *A,
|
|||||||
IDomA = IDomA->getIDom();
|
IDomA = IDomA->getIDom();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If B dominates A then B is nearest common dominator.
|
|
||||||
if (NodeADoms.count(NodeB) != 0)
|
|
||||||
return B;
|
|
||||||
|
|
||||||
// Walk NodeB immediate dominators chain and find common dominator node.
|
// Walk NodeB immediate dominators chain and find common dominator node.
|
||||||
DomTreeNode *IDomB = NodeB->getIDom();
|
DomTreeNode *IDomB = NodeB->getIDom();
|
||||||
while(IDomB) {
|
while(IDomB) {
|
||||||
|
Reference in New Issue
Block a user