[llvm] [InstCombine] Resolve FIXME: Use commutative matchers (PR #81060)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 16:23:37 PST 2024


================
@@ -1516,7 +1516,7 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
   // ~B + (A + 1) --> A - B
   // (~B + A) + 1 --> A - B
   // (A + ~B) + 1 --> A - B
-  if (match(&I, m_c_BinOp(m_Add(m_Value(A), m_One()), m_Not(m_Value(B)))) ||
+  if (match(&I, m_c_BinOp(m_c_Add(m_Value(A), m_One()), m_Not(m_Value(B)))) ||
----------------
topperc wrote:

Constants are canonicalized to the right hand size. A lot of these are unnecesary changes.

https://github.com/llvm/llvm-project/pull/81060


More information about the llvm-commits mailing list