[llvm] [InstCombine] Resolve FIXME: Use commutative matchers (PR #81060)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 7 16:57:19 PST 2024
================
@@ -2255,7 +2255,7 @@ Instruction *InstCombinerImpl::visitSub(BinaryOperator &I) {
// This is done in other passes, but we want to be able to consume this
// pattern in InstCombine so we can generate it without creating infinite
// loops.
- if (match(Op0, m_Add(m_Value(X), m_Value(Z))) &&
+ if (match(Op0, m_c_Add(m_Value(X), m_Value(Z))) &&
----------------
topperc wrote:
It doesn't matter. The `match` function in m_Value always returns true, so the m_Add will be satisfied on the first operand order it tries. It won't ever try the commuted order.
https://github.com/llvm/llvm-project/pull/81060
More information about the llvm-commits
mailing list