[PATCH] D68408: [InstCombine] Negator - sink sinkable negations

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 15:17:26 PST 2019


lebedev.ri updated this revision to Diff 232222.
lebedev.ri added a comment.

NOT READY FOR REVIEW
====================

In D68408#1769213 <https://reviews.llvm.org/D68408#1769213>, @spatel wrote:

> Remove more specific pattern-matching from InstCombiner::visitSub() simultaneously with adding this more general functionality, so we don't have redundancy (and limit compile-time impact)?


I was hoping to do that in steps, but i guess that's one way to boost those stats :))
I think i have moved everything relevant from `InstCombiner::visitSub()` now.
Observations:

- There's an artificial one-use restriction that needs to go away (when Depth=0 and we are looking at `sub 0, %x`)
- We loose/do not propagate no wrap flags
- `InstCombiner::visitAdd()` change is needed because of how good we are get at sinking negations - else there are two opposite folds. It should be done beforehand, separately.
- Same with `InstCombiner::foldAddWithConstant()` change, not entirely related to the diff.
- There are some other regressions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68408

Files:
  llvm/include/llvm/IR/Constant.h
  llvm/lib/IR/Constants.cpp
  llvm/lib/Transforms/InstCombine/CMakeLists.txt
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
  llvm/test/Transforms/InstCombine/ARM/strcmp.ll
  llvm/test/Transforms/InstCombine/abs-1.ll
  llvm/test/Transforms/InstCombine/add.ll
  llvm/test/Transforms/InstCombine/and-or-icmps.ll
  llvm/test/Transforms/InstCombine/apint-shift.ll
  llvm/test/Transforms/InstCombine/apint-sub.ll
  llvm/test/Transforms/InstCombine/div.ll
  llvm/test/Transforms/InstCombine/high-bit-signmask-with-trunc.ll
  llvm/test/Transforms/InstCombine/high-bit-signmask.ll
  llvm/test/Transforms/InstCombine/icmp.ll
  llvm/test/Transforms/InstCombine/logical-select.ll
  llvm/test/Transforms/InstCombine/mul.ll
  llvm/test/Transforms/InstCombine/sadd-with-overflow.ll
  llvm/test/Transforms/InstCombine/select.ll
  llvm/test/Transforms/InstCombine/shift.ll
  llvm/test/Transforms/InstCombine/ssub-with-overflow.ll
  llvm/test/Transforms/InstCombine/strcmp-1.ll
  llvm/test/Transforms/InstCombine/strncmp-1.ll
  llvm/test/Transforms/InstCombine/sub-of-negatible.ll
  llvm/test/Transforms/InstCombine/sub.ll
  llvm/test/Transforms/InstCombine/unsigned_saturated_sub.ll
  llvm/test/Transforms/InstCombine/zext-bool-add-sub.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68408.232222.patch
Type: text/x-patch
Size: 84313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191204/71122f65/attachment.bin>


More information about the llvm-commits mailing list