From: Chris Lattner Date: Mon, 25 Apr 2005 20:50:33 +0000 (+0000) Subject: Make dominates(A,B) work with post dominators. Patch contributed by X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=91bd25d9dfe050ec0cc549f2f5d2e83f91739732;p=oota-llvm.git Make dominates(A,B) work with post dominators. Patch contributed by Naveen Neelakantam, thanks! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21543 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index a59bd4eb065..04fef95552c 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -245,8 +245,13 @@ bool DominatorSetBase::dominates(Instruction *A, Instruction *B) const { BasicBlock::iterator I = BBA->begin(); for (; &*I != A && &*I != B; ++I) /*empty*/; - // A dominates B if it is found first in the basic block... - return &*I == A; + if(!IsPostDominators) { + // A dominates B if it is found first in the basic block. + return &*I == A; + } else { + // A post-dominates B if B is found first in the basic block. + return &*I == B; + } }