[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 05:41:12 PDT 2019


lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, nikic, huihuiz.
lebedev.ri added a project: LLVM.

To be noted, this pattern is not unhandled by instcombine per-se,
it is somehow does end up being folded when one runs opt -O3,
but not if it's just -instcombine. Regardless, that fold is
indirect, depends on some other folds, and is thus blind
when there are extra uses.

This does address the regression being exposed in previous patch D63992 <https://reviews.llvm.org/D63992>.

https://godbolt.org/z/7DGltU
https://rise4fun.com/Alive/EPO0


Repository:
  rL LLVM

https://reviews.llvm.org/D63993

Files:
  lib/Transforms/InstCombine/InstCombineAddSub.cpp
  test/Transforms/InstCombine/add.ll
  test/Transforms/InstCombine/fold-inc-of-add-of-not-x-and-y-to-sub-x-from-y.ll
  test/Transforms/InstCombine/sub-minmax.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63993.207264.patch
Type: text/x-patch
Size: 7148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/13be68be/attachment.bin>


More information about the llvm-commits mailing list