>From 6795022bc9151c10dbccbd6a18402794dcd5f412 Mon Sep 17 00:00:00 2001
From: Tobias Grosser <grosser@fim.uni-passau.de>
Date: Mon, 8 Mar 2010 10:08:21 +0100
Subject: [PATCH] findNearestCommonDominator works for PostDominator

Disable an optimization for the DominatorTree, to make
findNearestCommonDominator also work with the PostDominatorTree.
---
 include/llvm/Analysis/Dominators.h |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 1e94f30..aaf86f3 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -431,15 +431,15 @@ 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 (!this->isPostDominator()) {
+      // 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 B dominates A then B is nearest common dominator.
     if (dominates(B, A))
-- 
1.6.4.4

