[PATCH] D84655: [InstSimplify] fold min/max intrinsics using icmp simplification

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 27 06:52:57 PDT 2020


spatel created this revision.
spatel added reviewers: nikic, lebedev.ri, aqjune.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

As discussed in rG0481e1ae3c17 <https://reviews.llvm.org/rG0481e1ae3c17a8faa6c8e319495a51a76b77b76b>, we can use icmp simplification to reduce min/max intrinsics, so we don't have to re-implement a long list of possible transforms.

But (if my undef reasoning is correct), this is not as easy as always returning the existing operand. In the case of undefs, we need to clamp to the limit constant. This is similar to what we do with the saturating math intrinsics.


https://reviews.llvm.org/D84655

Files:
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84655.280892.patch
Type: text/x-patch
Size: 13236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200727/75b52758/attachment.bin>


More information about the llvm-commits mailing list