[PATCH] D57620: Optimize printf calls that don't use 128-bit floating-point values

Dan Gohman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 1 14:24:16 PST 2019


sunfish created this revision.
Herald added a project: LLVM.

lib/Transforms/Utils/SimplifyLibCalls.cpp currently contains an optimization where it converts calls to `printf` that don't have any floating-point arguments into calls to `iprintf`, on targets which have it, which is like `printf` except without support for floating-point numbers. This allows programs that don't need floating-point formatting to avoid linking in the floating-point formatting code, which can save several thousands of bytes.

This patch adds a similar optimization for when there are floating-point arguments, but no 128-bit floating-point arguments, transforming such calls to `printf_no_Lf` (though I'm more than happy to accept suggestions for better names). Since 128-bit floats are implemented in software, `printf_no_Lf` can't be quite as small as `iprintf`, but it still can be significantly smaller than the full `printf`.


Repository:
  rL LLVM

https://reviews.llvm.org/D57620

Files:
  include/llvm/Analysis/TargetLibraryInfo.def
  lib/Analysis/TargetLibraryInfo.cpp
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  unittests/Analysis/TargetLibraryInfoTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57620.184842.patch
Type: text/x-patch
Size: 6638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190201/23019f71/attachment.bin>


More information about the llvm-commits mailing list