[PATCH] D33186: [InstCombine] Canonicalize clamp of float types to minmax in fast mode.

Andrei Elovikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 04:25:21 PDT 2017


a.elovikov created this revision.

This commit allows matchSelectPattern to recognize clamp of float
arguments in the presence of FMF the same way as already done for
integers.

This case is a little different though. With integers, given the
min/max pattern is recognized, DAGBuilder starts selecting MIN/MAX
"automatically". That is not the case for float, because for them only
full FMINNAN/FMINNUM/FMAXNAN/FMAXNUM ISD nodes exist and they do care
about NaNs. On the other hand, some backends (e.g. X86) have only
FMIN/FMAX nodes that do not care about NaNS and the former NAN/NUM
nodes are illegal thus selection is not happening. So I decided to do
such kind of transformation in IR (InstCombiner) instead of
complicating the logic in the backend.


https://reviews.llvm.org/D33186

Files:
  llvm/include/llvm/IR/PatternMatch.h
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/test/Transforms/InstCombine/clamp-to-minmax.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33186.98978.patch
Type: text/x-patch
Size: 28646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170515/75423c98/attachment.bin>


More information about the llvm-commits mailing list