[llvm] 56ad7cc - [IR] Remove non-canonical matchings (#96763)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 00:47:42 PDT 2024
Author: AtariDreams
Date: 2024-07-22T09:47:37+02:00
New Revision: 56ad7cc0126f9899fd884391cfa10b6359206c01
URL: https://github.com/llvm/llvm-project/commit/56ad7cc0126f9899fd884391cfa10b6359206c01
DIFF: https://github.com/llvm/llvm-project/commit/56ad7cc0126f9899fd884391cfa10b6359206c01.diff
LOG: [IR] Remove non-canonical matchings (#96763)
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 5c56654246ead..8f1c42b7ede44 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -934,7 +934,7 @@ getKnownBitsFromAndXorOr(const Operator *I, const APInt &DemandedElts,
// Demanded) == (xor(x, x-1) & Demanded). Extend the xor pattern
// to use arbitrary C if xor(x, x-C) as the same as xor(x, x-1).
if (HasKnownOne &&
- match(I, m_c_Xor(m_Value(X), m_c_Add(m_Deferred(X), m_AllOnes())))) {
+ match(I, m_c_Xor(m_Value(X), m_Add(m_Deferred(X), m_AllOnes())))) {
const KnownBits &XBits = I->getOperand(0) == X ? KnownLHS : KnownRHS;
KnownOut = XBits.blsmsk();
}
diff --git a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
index b75cd1beadc58..4ef009c87a1e6 100644
--- a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
@@ -829,7 +829,7 @@ bool PolynomialMultiplyRecognize::matchRightShift(SelectInst *SelI,
return false;
Value *X = nullptr;
- if (!match(C, m_c_And(m_Value(X), m_One())))
+ if (!match(C, m_And(m_Value(X), m_One())))
return false;
// Matched: select (X & 1) == +++ ? ... : ...
// select (X & 1) != +++ ? ... : ...
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(
More information about the llvm-commits
mailing list