[PATCH] D63993: [InstCombine] (Y + ~X) + 1 --> Y - X fold (PR42459)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 07:00:43 PDT 2019


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1207-1210
   // (A + 1) + ~B --> A - B
   // ~B + (A + 1) --> A - B
   if (match(&I, m_c_BinOp(m_Add(m_Value(A), m_One()), m_Not(m_Value(B)))))
     return BinaryOperator::CreateSub(A, B);
----------------
Here's the sibling matcher. The -reassociation pass tries to create this form (move constant operands up in a chain of reassociative ops).


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63993/new/

https://reviews.llvm.org/D63993





More information about the llvm-commits mailing list