[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h
Devang Patel
dpatel at apple.com
Thu Jun 7 17:21:40 PDT 2007
Changes in directory llvm/include/llvm/Analysis:
Dominators.h updated: 1.97 -> 1.98
---
Log message:
Add new method - nearestCommonDominator().
---
Diffs of the changes: (+11 -0)
Dominators.h | 11 +++++++++++
1 files changed, 11 insertions(+)
Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.97 llvm/include/llvm/Analysis/Dominators.h:1.98
--- llvm/include/llvm/Analysis/Dominators.h:1.97 Thu Jun 7 18:52:40 2007
+++ llvm/include/llvm/Analysis/Dominators.h Thu Jun 7 19:21:17 2007
@@ -185,6 +185,17 @@
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
/// constant time operation!
///
More information about the llvm-commits
mailing list