HomePhabricator

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

Description

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

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.

To reduce the risk of harming efficient code, the pass only attempts to perform complete removal of inttofp/fptoint operations, not just move them around.

Details

Committed
jamesmMar 24 2015, 4:15 AM
Parents
rL233061: Fetch module specification from remote process also
Branches
Unknown
Tags
Unknown