diff options
author | Craig Topper <craig.topper@sifive.com> | 2023-12-07 10:27:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-07 10:27:57 -0800 |
commit | 32ec5fbfed32f37aa070ee38e9b038bd84ca6479 (patch) | |
tree | 1dc4058605c0fe75ae24beefcda12829b5ad847f | |
parent | ea991a11b2a3d2bfa545adbefb71cd17e8970a43 (diff) | |
download | llvm-32ec5fbfed32f37aa070ee38e9b038bd84ca6479.zip llvm-32ec5fbfed32f37aa070ee38e9b038bd84ca6479.tar.gz llvm-32ec5fbfed32f37aa070ee38e9b038bd84ca6479.tar.bz2 |
[ValueTracking] Use BinaryOperator instead of Operator in matchSimpleRecurrence. (#74678)
Operator allows the phi operand to be a ConstantExpr. A ConstantExpr is
a valid operand to a phi, but is never going to be a recurrence.
We can only match a BinaryOperator so use that instead.
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 2c52107..dfd3686 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -8024,7 +8024,7 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO, for (unsigned i = 0; i != 2; ++i) { Value *L = P->getIncomingValue(i); Value *R = P->getIncomingValue(!i); - Operator *LU = dyn_cast<Operator>(L); + auto *LU = dyn_cast<BinaryOperator>(L); if (!LU) continue; unsigned Opcode = LU->getOpcode(); @@ -8062,7 +8062,7 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO, // OR // %iv = [R, %entry], [%iv.next, %backedge] // %iv.next = binop L, %iv - BO = cast<BinaryOperator>(LU); + BO = LU; Start = R; Step = L; return true; |