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

Dmitry Babokin babokin at gmail.com
Sun Apr 15 03:28:13 PDT 2012


On Sun, Apr 15, 2012 at 1:20 PM, Renato Golin <rengolin at systemcall.org>wrote:

> 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.
>

It's not a user error. User knows his code and accuracy of his code much
better, than any compiler could possible do and may have strong reasons to
specify fast-math for one function and not specify for another.

>
> 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.
>

If the user specified different fp-models to different functions on
purpose, the most likely you'll ruin performance by assuming stricter model
the result of inlining.

>
> Just guessing for the future, I agree with you that the first
> implementation should be very simple, as it is.
>
> cheers,
> --renato
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120415/8610dd64/attachment.html>


More information about the llvm-dev mailing list