diff options
author | Chad Rosier <mcrosier@codeaurora.org> | 2016-04-25 17:23:36 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@codeaurora.org> | 2016-04-25 17:23:36 +0000 |
commit | e2cbd13e5634e16301cd9e4b88b5ea08accafe9f (patch) | |
tree | 21cf5562f959fc1476cb2b129c884fb939e74267 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 8d728fccb8266004f23485a9b336825d2fa79fd8 (diff) | |
download | bcm5719-llvm-e2cbd13e5634e16301cd9e4b88b5ea08accafe9f.tar.gz bcm5719-llvm-e2cbd13e5634e16301cd9e4b88b5ea08accafe9f.zip |
[ValueTracking] Improve isImpliedCondition when the dominating cond is false.
llvm-svn: 267430
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 5ada78a5350..a9b8af1017c 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -3962,8 +3962,8 @@ static Optional<bool> isImpliedCondMatchingOperands(CmpInst::Predicate APred, } Optional<bool> llvm::isImpliedCondition(Value *LHS, Value *RHS, - const DataLayout &DL, unsigned Depth, - AssumptionCache *AC, + const DataLayout &DL, bool InvertAPred, + unsigned Depth, AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT) { assert(LHS->getType() == RHS->getType() && "mismatched type"); @@ -3971,7 +3971,7 @@ Optional<bool> llvm::isImpliedCondition(Value *LHS, Value *RHS, assert(OpTy->getScalarType()->isIntegerTy(1)); // LHS ==> RHS by definition - if (LHS == RHS) + if (!InvertAPred && LHS == RHS) return true; if (OpTy->isVectorTy()) @@ -3987,6 +3987,9 @@ Optional<bool> llvm::isImpliedCondition(Value *LHS, Value *RHS, !match(RHS, m_ICmp(BPred, m_Value(BLHS), m_Value(BRHS)))) return None; + if (InvertAPred) + APred = CmpInst::getInversePredicate(APred); + Optional<bool> Implication = isImpliedCondMatchingOperands(APred, ALHS, ARHS, BPred, BLHS, BRHS); if (Implication) |