diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-06 19:01:08 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-06 19:01:08 +0000 |
commit | 55ea67cea7f9fa45fe066c8670804582ad028faa (patch) | |
tree | 3dcf6d45786fca187336ca531f7bc368dfc82e5a /llvm/lib/Analysis/ValueTracking.cpp | |
parent | c01b4d2b28184d0a9efee934c8a5b7aab57984ab (diff) | |
download | llvm-55ea67cea7f9fa45fe066c8670804582ad028faa.zip llvm-55ea67cea7f9fa45fe066c8670804582ad028faa.tar.gz llvm-55ea67cea7f9fa45fe066c8670804582ad028faa.tar.bz2 |
[ValueTracking] Add parameters to isImpliedCondition; NFC
Summary:
This change makes the `isImpliedCondition` interface similar to the rest
of the functions in ValueTracking (in that it takes a DataLayout,
AssumptionCache etc.). This is an NFC, intended to make a later diff
less noisy.
Depends on D14369
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14391
llvm-svn: 252333
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index f4824ae..abec596 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4083,7 +4083,10 @@ ConstantRange llvm::getConstantRangeFromMetadata(MDNode &Ranges) { } /// Return true if "icmp Pred LHS RHS" is always true. -static bool isTruePredicate(CmpInst::Predicate Pred, Value *LHS, Value *RHS) { +static bool isTruePredicate(CmpInst::Predicate Pred, Value *LHS, Value *RHS, + const DataLayout &DL, unsigned Depth, + AssumptionCache *AC, const Instruction *CxtI, + const DominatorTree *DT) { if (ICmpInst::isTrueWhenEqual(Pred) && LHS == RHS) return true; @@ -4124,24 +4127,34 @@ static bool isTruePredicate(CmpInst::Predicate Pred, Value *LHS, Value *RHS) { /// Return true if "icmp Pred BLHS BRHS" is true whenever "icmp Pred /// ALHS ARHS" is true. static bool isImpliedCondOperands(CmpInst::Predicate Pred, Value *ALHS, - Value *ARHS, Value *BLHS, Value *BRHS) { + Value *ARHS, Value *BLHS, Value *BRHS, + const DataLayout &DL, unsigned Depth, + AssumptionCache *AC, const Instruction *CxtI, + const DominatorTree *DT) { switch (Pred) { default: return false; case CmpInst::ICMP_SLT: case CmpInst::ICMP_SLE: - return isTruePredicate(CmpInst::ICMP_SLE, BLHS, ALHS) && - isTruePredicate(CmpInst::ICMP_SLE, ARHS, BRHS); + return isTruePredicate(CmpInst::ICMP_SLE, BLHS, ALHS, DL, Depth, AC, CxtI, + DT) && + isTruePredicate(CmpInst::ICMP_SLE, ARHS, BRHS, DL, Depth, AC, CxtI, + DT); case CmpInst::ICMP_ULT: case CmpInst::ICMP_ULE: - return isTruePredicate(CmpInst::ICMP_ULE, BLHS, ALHS) && - isTruePredicate(CmpInst::ICMP_ULE, ARHS, BRHS); + return isTruePredicate(CmpInst::ICMP_ULE, BLHS, ALHS, DL, Depth, AC, CxtI, + DT) && + isTruePredicate(CmpInst::ICMP_ULE, ARHS, BRHS, DL, Depth, AC, CxtI, + DT); } } -bool llvm::isImpliedCondition(Value *LHS, Value *RHS) { +bool llvm::isImpliedCondition(Value *LHS, Value *RHS, const DataLayout &DL, + unsigned Depth, AssumptionCache *AC, + const Instruction *CxtI, + const DominatorTree *DT) { assert(LHS->getType() == RHS->getType() && "mismatched type"); Type *OpTy = LHS->getType(); assert(OpTy->getScalarType()->isIntegerTy(1)); @@ -4163,7 +4176,8 @@ bool llvm::isImpliedCondition(Value *LHS, Value *RHS) { return false; if (APred == BPred) - return isImpliedCondOperands(APred, ALHS, ARHS, BLHS, BRHS); + return isImpliedCondOperands(APred, ALHS, ARHS, BLHS, BRHS, DL, Depth, AC, + CxtI, DT); return false; } |