[PATCH] D63214: [InstCombine] canonicalize fmin/fmax to LLVM intrinsics minnum/maxnum

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 09:02:22 PDT 2019


spatel created this revision.
spatel added reviewers: cameron.mcinally, arsenm, efriedma.
Herald added subscribers: hiraditya, wdng, mcrosier.
Herald added a project: LLVM.

This transform came up in D62414 <https://reviews.llvm.org/D62414>, but we should deal with it first. 
We have LLVM intrinsics that correspond exactly to libm calls (unlike most libm calls, these libm calls never set errno). 
This holds without any fast-math-flags, so we should always canonicalize to those intrinsics directly for better optimization.
Currently, we convert to fcmp+select only when we have FMF (nnan) because fcmp+select does not preserve the semantics of the call in the general case.


https://reviews.llvm.org/D63214

Files:
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/test/Transforms/InstCombine/fast-math.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63214.204300.patch
Type: text/x-patch
Size: 8183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190612/de3754ea/attachment.bin>


More information about the llvm-commits mailing list