mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
VPlan/PatternMatch: introduce m_c_Mul (NFC) (#93950)
Introduce a commutative version of m_Mul, and simplify a usage based on it.
This commit is contained in:
committed by
GitHub
parent
20483edd27
commit
0e743ecca0
@@ -274,6 +274,13 @@ m_Mul(const Op0_t &Op0, const Op1_t &Op1) {
|
||||
return m_Binary<Instruction::Mul, Op0_t, Op1_t>(Op0, Op1);
|
||||
}
|
||||
|
||||
template <typename Op0_t, typename Op1_t>
|
||||
inline AllBinaryRecipe_match<Op0_t, Op1_t, Instruction::Mul,
|
||||
/* Commutative =*/true>
|
||||
m_c_Mul(const Op0_t &Op0, const Op1_t &Op1) {
|
||||
return m_Binary<Instruction::Mul, Op0_t, Op1_t, true>(Op0, Op1);
|
||||
}
|
||||
|
||||
/// Match a binary OR operation. Note that while conceptually the operands can
|
||||
/// be matched commutatively, \p Commutative defaults to false in line with the
|
||||
/// IR-based pattern matching infrastructure. Use m_c_BinaryOr for a commutative
|
||||
|
||||
@@ -1037,8 +1037,7 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (match(&R, m_CombineOr(m_Mul(m_VPValue(A), m_SpecificInt(1)),
|
||||
m_Mul(m_SpecificInt(1), m_VPValue(A)))))
|
||||
if (match(&R, m_c_Mul(m_VPValue(A), m_SpecificInt(1))))
|
||||
return R.getVPSingleValue()->replaceAllUsesWith(A);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user