[LLVMdev] Representing -ffast-math at the IR level

Renato Golin rengolin at systemcall.org
Sun Apr 15 02:20:44 PDT 2012


On 15 April 2012 09:07, Duncan Sands <baldrick at free.fr> wrote:
> Link-time optimization will sometimes result in "fast-math" functions being
> inlined into non-fast math functions and vice-versa.  This pretty much
> inevitably means that per-instruction fpmath options are required.

I guess it would be user error if a strict function used the results
of a non-strict function (explicitly compiled with -ffast-math) and
complain about loss of precision. In that case, the inlining keeping
the option per-line makes total sense.

Would there be need to make fast-math less strict, ie. to only use it
when no strict FP result needs its result? In this case, an option in
the whole function would guarantee that all inlined instructions would
be modified to strict, even if relaxed in the first place.

Just guessing for the future, I agree with you that the first
implementation should be very simple, as it is.

cheers,
--renato




More information about the llvm-dev mailing list