diff options
author | Dan Gohman <gohman@apple.com> | 2010-03-24 00:22:24 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-03-24 00:22:24 +0000 |
commit | 66617633e7dcc14d8808d3118766916b2240722a (patch) | |
tree | 0962a6b1ecbdc34f9e8cd0fb05aa1a3ec44f339f /include | |
parent | 7e504141e05e1370835d629349b6024e526ccf73 (diff) | |
download | llvm-66617633e7dcc14d8808d3118766916b2240722a.tar.gz llvm-66617633e7dcc14d8808d3118766916b2240722a.tar.bz2 llvm-66617633e7dcc14d8808d3118766916b2240722a.tar.xz |
Generalize findNearestCommonDominator to work on post-dominators,
based on a suggestion by Jochen Wilhelmy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99361 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 1e94f304c9..263862726e 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -431,15 +431,16 @@ public: /// for basic block A and B. If there is no such block then return NULL. NodeT *findNearestCommonDominator(NodeT *A, NodeT *B) { - assert (!this->isPostDominator() - && "This is not implemented for post dominators"); assert (A->getParent() == B->getParent() && "Two blocks are not in same function"); - // If either A or B is a entry block then it is nearest common dominator. - NodeT &Entry = A->getParent()->front(); - if (A == &Entry || B == &Entry) - return &Entry; + // If either A or B is a entry block then it is nearest common dominator + // (for forward-dominators). + if (!this->isPostDominator()) { + NodeT &Entry = A->getParent()->front(); + if (A == &Entry || B == &Entry) + return &Entry; + } // If B dominates A then B is nearest common dominator. if (dominates(B, A)) |