It is not possible to determie dominance between two PHI nodes
authorDevang Patel <dpatel@apple.com>
Mon, 26 Mar 2007 23:18:28 +0000 (23:18 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 26 Mar 2007 23:18:28 +0000 (23:18 +0000)
based on their ordering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35369 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Dominators.cpp

index a0e818fc313d8c2a73c7de87d2e338b5721bdd04..7019c98d89e1384fe1fa11d66a08f83656b0a3ff 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm/Assembly/Writer.h"
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/SetOperations.h"
+#include "llvm/Instructions.h"
 #include <algorithm>
 using namespace llvm;
 
@@ -265,6 +266,11 @@ bool DominatorSetBase::dominates(Instruction *A, Instruction *B) const {
   BasicBlock *BBA = A->getParent(), *BBB = B->getParent();
   if (BBA != BBB) return dominates(BBA, BBB);
 
+  // It is not possible to determie dominance between two PHI nodes 
+  // based on their ordering.
+  if (isa<PHINode>(A) && isa<PHINode>(B)) 
+    return false;
+
   // Loop through the basic block until we find A or B.
   BasicBlock::iterator I = BBA->begin();
   for (; &*I != A && &*I != B; ++I) /*empty*/;