diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2021-03-09 00:04:47 +0100 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2021-03-09 00:04:47 +0100 |
commit | 0d96ea0792bccca804ed89f7116ef518e40bf34a (patch) | |
tree | b475b27a60577c060ec041de20ed08ef99fc459f /llvm/lib/Analysis/ValueTracking.cpp | |
parent | cfd7d8123a3b1e77343763ac2b62124bfcffe6d6 (diff) | |
download | llvm-0d96ea0792bccca804ed89f7116ef518e40bf34a.zip llvm-0d96ea0792bccca804ed89f7116ef518e40bf34a.tar.gz llvm-0d96ea0792bccca804ed89f7116ef518e40bf34a.tar.bz2 |
[ValueTracking] Move matchSimpleRecurrence out of line
The header only has a forward declaration of PHINode available, and this
function doesn't seem to get much out of inlining.
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, |