[PATCH] D63993: [InstCombine] (Y + ~X) + 1 --> Y - X fold (PR42459)
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 07:04:11 PDT 2019
lebedev.ri marked 2 inline comments as done.
lebedev.ri 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);
----------------
spatel wrote:
> Here's the sibling matcher. The -reassociation pass tries to create this form (move constant operands up in a chain of reassociative ops).
Yep, found it once i understood that the fold *was* being done by instcombine after all (after adding commutative tests), and moved the fold here.
Though i don't understand the `-print-after-all` output, `-reassociation` does not run there..
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