[PATCH] "float2int": Add a new pass to demote from float to int where possible.

James Molloy james.molloy at arm.com
Fri Feb 20 07:58:47 PST 2015


Hi hfinkel,

It is possible to have code that converts from integer to float, performs
operations then converts back, and the result is provably the same as if
integers were used.

This can come from different sources, but the most obvious is a helper function
that uses floats but the arguments given at an inlined callsites are integers.

This pass considers all integers requiring a bitwidth less than or equal to
the bitwidth of the mantissa of a floating point type (23 for floats, 52 for
doubles) as exactly representable in floating point.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7790

Files:
  include/llvm/InitializePasses.h
  include/llvm/LinkAllPasses.h
  include/llvm/Transforms/Scalar.h
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Scalar/CMakeLists.txt
  lib/Transforms/Scalar/Float2Int.cpp
  lib/Transforms/Scalar/Scalar.cpp
  test/Transforms/Float2Int/basic.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7790.20404.patch
Type: text/x-patch
Size: 25695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150220/8ec8d76d/attachment.bin>


More information about the llvm-commits mailing list