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; + } }