[PATCH] D67799: [InstCombine] Fold a shifty implementation of clamp0.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 23:30:53 PDT 2019


huihuiz created this revision.
huihuiz added reviewers: lebedev.ri, efriedma, spatel, kparzysz, bcahoon.
huihuiz added a project: LLVM.
Herald added subscribers: hiraditya, kristof.beyls.

Fold

  and(ashr(sub(0, V), ScalarSizeInBits - 1), V)

into

  V s< 0 ? 0 : V

where sub hasNoSignedWrap.

https://rise4fun.com/Alive/ZNSs

Fold shift into select enable more optimization, e.g., vmax generation for ARM target.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67799

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/sub-ashr-and-to-icmp-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67799.220954.patch
Type: text/x-patch
Size: 5345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190920/9dd7f9da/attachment.bin>


More information about the llvm-commits mailing list