[PATCH] D48535: [InstCombine] (A + 1) + (B ^ -1) --> A - B

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 25 02:34:26 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1217
+  // ~B + (A + 1) --> A - B
+  if (match(&I, m_c_BinOp(m_c_Add(m_Value(A), m_One()), m_Not(m_Value(B)))))
+    return BinaryOperator::CreateSub(A, B);
----------------
The constants are already canonicalized to RHS, so it's just `m_Add()`.


Repository:
  rL LLVM

https://reviews.llvm.org/D48535





More information about the llvm-commits mailing list