[llvm] [Scalar] Use commutative matchers to avoid duplication (NFC) (PR #97223)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 30 09:48:08 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: AtariDreams (AtariDreams)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/97223.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp (+2-4)
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
index 9be60721bebb5..75585fcc80266 100644
--- a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
@@ -425,14 +425,12 @@ void StraightLineStrengthReduce::allocateCandidatesAndFindBasisForAdd(
// Returns true if A matches B + C where C is constant.
static bool matchesAdd(Value *A, Value *&B, ConstantInt *&C) {
- return (match(A, m_Add(m_Value(B), m_ConstantInt(C))) ||
- match(A, m_Add(m_ConstantInt(C), m_Value(B))));
+ return match(A, m_c_Add(m_Value(B), m_ConstantInt(C)));
}
// Returns true if A matches B | C where C is constant.
static bool matchesOr(Value *A, Value *&B, ConstantInt *&C) {
- return (match(A, m_Or(m_Value(B), m_ConstantInt(C))) ||
- match(A, m_Or(m_ConstantInt(C), m_Value(B))));
+ return match(A, m_c_Or(m_Value(B), m_ConstantInt(C)));
}
void StraightLineStrengthReduce::allocateCandidatesAndFindBasisForMul(
``````````
</details>
https://github.com/llvm/llvm-project/pull/97223
More information about the llvm-commits
mailing list