Skip to content

Commit 56ad7cc

Browse files
authored
[IR] Remove non-canonical matchings (llvm#96763)
1 parent 12762b8 commit 56ad7cc

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ getKnownBitsFromAndXorOr(const Operator *I, const APInt &DemandedElts,
934934
// Demanded) == (xor(x, x-1) & Demanded). Extend the xor pattern
935935
// to use arbitrary C if xor(x, x-C) as the same as xor(x, x-1).
936936
if (HasKnownOne &&
937-
match(I, m_c_Xor(m_Value(X), m_c_Add(m_Deferred(X), m_AllOnes())))) {
937+
match(I, m_c_Xor(m_Value(X), m_Add(m_Deferred(X), m_AllOnes())))) {
938938
const KnownBits &XBits = I->getOperand(0) == X ? KnownLHS : KnownRHS;
939939
KnownOut = XBits.blsmsk();
940940
}

llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ bool PolynomialMultiplyRecognize::matchRightShift(SelectInst *SelI,
829829
return false;
830830

831831
Value *X = nullptr;
832-
if (!match(C, m_c_And(m_Value(X), m_One())))
832+
if (!match(C, m_And(m_Value(X), m_One())))
833833
return false;
834834
// Matched: select (X & 1) == +++ ? ... : ...
835835
// select (X & 1) != +++ ? ... : ...

llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,12 @@ void StraightLineStrengthReduce::allocateCandidatesAndFindBasisForAdd(
425425

426426
// Returns true if A matches B + C where C is constant.
427427
static bool matchesAdd(Value *A, Value *&B, ConstantInt *&C) {
428-
return (match(A, m_Add(m_Value(B), m_ConstantInt(C))) ||
429-
match(A, m_Add(m_ConstantInt(C), m_Value(B))));
428+
return match(A, m_c_Add(m_Value(B), m_ConstantInt(C)));
430429
}
431430

432431
// Returns true if A matches B | C where C is constant.
433432
static bool matchesOr(Value *A, Value *&B, ConstantInt *&C) {
434-
return (match(A, m_Or(m_Value(B), m_ConstantInt(C))) ||
435-
match(A, m_Or(m_ConstantInt(C), m_Value(B))));
433+
return match(A, m_c_Or(m_Value(B), m_ConstantInt(C)));
436434
}
437435

438436
void StraightLineStrengthReduce::allocateCandidatesAndFindBasisForMul(

0 commit comments

Comments
 (0)