Add new method - nearestCommonDominator().

llvm-svn: 37508
This commit is contained in:
Devang Patel 2007-06-08 00:21:17 +00:00
parent aee309e353
commit bc3b9a1c8a
1 changed files with 11 additions and 0 deletions

View File

@ -185,6 +185,17 @@ protected:
void updateDFSNumbers(); void updateDFSNumbers();
/// Return the nearest common dominator of A and B.
BasicBlock *nearestCommonDominator(BasicBlock *A, BasicBlock *B) const {
ETNode *NodeA = getNode(A)->getETNode();
ETNode *NodeB = getNode(B)->getETNode();
ETNode *Common = NodeA->NCA(NodeB);
if (!Common)
return NULL;
return Common->getData<BasicBlock>();
}
/// dominates - Returns true iff this dominates N. Note that this is not a /// dominates - Returns true iff this dominates N. Note that this is not a
/// constant time operation! /// constant time operation!
/// ///