[PATCH] D58877: [InstCombine] fold add(add(A, ~B), 1) -> sub(A, B)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 3 07:08:36 PST 2019


spatel added a comment.

In D58877#1416363 <https://reviews.llvm.org/D58877#1416363>, @RKSimon wrote:

> Test for ((A + 1) + ~B) and ((~B + 1) + A) cases?


We already get that case in instcombine. So this brings up a question of division-of-labor. The -reassociate pass will take the pattern from this patch and form the above because it "ranks" the constant 1 above a variable operand. Then instcombine can fold it. Is that good enough, or do we need to handle a pattern that is not canonical based on the output of -reassociate. Unless we have evidence that this is slipping through a normal opt -O1 pipeline, we probably do not need this patch?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58877





More information about the llvm-commits mailing list