summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Dominators.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-06-12 17:17:57 +0000
committerDevang Patel <dpatel@apple.com>2007-06-12 17:17:57 +0000
commitdcf0c03ff74dd8813fb57338c21413819db02dcd (patch)
tree8da78c8b40a4346ec71e8dba2a71d63199d92973 /llvm/lib/VMCore/Dominators.cpp
parent2150cde0e4be16a9331c17c7f19e8d1b29d28a2e (diff)
downloadbcm5719-llvm-dcf0c03ff74dd8813fb57338c21413819db02dcd.tar.gz
bcm5719-llvm-dcf0c03ff74dd8813fb57338c21413819db02dcd.zip
Check A dominates B and vise versa first while searching for nearest
common dominator. llvm-svn: 37559
Diffstat (limited to 'llvm/lib/VMCore/Dominators.cpp')
-rw-r--r--llvm/lib/VMCore/Dominators.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/VMCore/Dominators.cpp b/llvm/lib/VMCore/Dominators.cpp
index 4d125fb0223..35b2bbfc224 100644
--- a/llvm/lib/VMCore/Dominators.cpp
+++ b/llvm/lib/VMCore/Dominators.cpp
@@ -387,12 +387,12 @@ BasicBlock *DominatorTreeBase::findNearestCommonDominator(BasicBlock *A,
DomTreeNode *NodeB = getNode(B);
- // If B immediately dominates A then B is nearest common dominator.
- if (NodeA->getIDom() == NodeB)
+ // If B dominates A then B is nearest common dominator.
+ if (dominates(B,A))
return B;
- // If A immediately dominates B then A is nearest common dominator.
- if (NodeB->getIDom() == NodeA)
+ // If A dominates B then A is nearest common dominator.
+ if (dominates(A,B))
return A;
// Collect NodeA dominators set.
@@ -404,10 +404,6 @@ BasicBlock *DominatorTreeBase::findNearestCommonDominator(BasicBlock *A,
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.
DomTreeNode *IDomB = NodeB->getIDom();
while(IDomB) {
OpenPOWER on IntegriCloud