[PATCH] Shrinkify libcalls: use float versions of double libm functions with fast-math (bug 17850)

Sanjay Patel spatel at rotateright.com
Tue Oct 21 14:38:26 PDT 2014


Hi hfinkel, beanz,

When a call to a double-precision libm function has fast-math semantics (via function attribute for now because there is no IR-level FMF on calls), we can avoid fpext/fptrunc operations and use the float version of the call if the input and output are both float.

We already do this optimization using a command-line option; this patch just adds the ability for fast-math to use the existing functionality.

I moved the cl::opt from InstructionCombining into SimplifyLibCalls because it's only ever used internally to that class.

Is it possible to conditionalize test case code from a RUN line? If yes, I could combine all of the new test cases with the existing test file instead of creating a new file.

This patch should solve: http://llvm.org/bugs/show_bug.cgi?id=17850

http://reviews.llvm.org/D5893

Files:
  include/llvm/Transforms/Utils/SimplifyLibCalls.h
  lib/Transforms/InstCombine/InstructionCombining.cpp
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/Transforms/InstCombine/double-float-shrink-fast.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5893.15209.patch
Type: text/x-patch
Size: 14373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141021/61d66cd8/attachment.bin>


More information about the llvm-commits mailing list