aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/Dominators.h
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-06-07 18:39:40 +0000
committerDevang Patel <dpatel@apple.com>2007-06-07 18:39:40 +0000
commit259e6cf1911a91ed80f77b132d1509fd0581a4a1 (patch)
treec1369a62cbcf27180cc5d32dc5fd7667bb8e2e5f /include/llvm/Analysis/Dominators.h
parent9a51157db555395f7a6ad89faec40b3afa121091 (diff)
downloadexternal_llvm-259e6cf1911a91ed80f77b132d1509fd0581a4a1.zip
external_llvm-259e6cf1911a91ed80f77b132d1509fd0581a4a1.tar.gz
external_llvm-259e6cf1911a91ed80f77b132d1509fd0581a4a1.tar.bz2
Add BasicBlock level dominates(A,B) interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/Dominators.h')
-rw-r--r--include/llvm/Analysis/Dominators.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 87ea6c1..96f3f22 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -170,11 +170,16 @@ protected:
}
void updateDFSNumbers();
+
/// dominates - Returns true iff this dominates N. Note that this is not a
/// constant time operation!
///
inline bool dominates(const DomTreeNode *A, DomTreeNode *B) {
- if (B == A) return true; // A node trivially dominates itself.
+ if (B == A)
+ return true; // A node trivially dominates itself.
+
+ if (A == 0 || B == 0)
+ return false;
ETNode *NodeA = A->getETNode();
ETNode *NodeB = B->getETNode();
@@ -192,7 +197,14 @@ protected:
//return NodeB->DominatedBySlow(NodeA);
return dominatedBySlowTreeWalk(A, B);
}
-
+
+ inline bool dominates(BasicBlock *A, BasicBlock *B) {
+ if (A == B)
+ return true;
+
+ return dominates(getNode(A), getNode(B));
+ }
+
//===--------------------------------------------------------------------===//
// API to update (Post)DominatorTree information based on modifications to
// the CFG...