diff options
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 0a50718..79399cf 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -6102,6 +6102,15 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO, return false; } +bool llvm::matchSimpleRecurrence(const BinaryOperator *I, PHINode *&P, + Value *&Start, Value *&Step) { + BinaryOperator *BO = nullptr; + P = dyn_cast<PHINode>(I->getOperand(0)); + if (!P) + P = dyn_cast<PHINode>(I->getOperand(1)); + return P && matchSimpleRecurrence(P, BO, Start, Step) && BO == I; +} + /// Return true if "icmp Pred LHS RHS" is always true. static bool isTruePredicate(CmpInst::Predicate Pred, const Value *LHS, const Value *RHS, const DataLayout &DL, |