Should we have a "don't simplify floating point at all" flag?

Duncan Sands baldrick at free.fr
Mon Mar 18 08:09:44 PDT 2013


Hi David,

> I've just committed r177279,r177280 which fix a straight bug in the handling
> of the vector case of floating point simplification
>
> fadd X, (-0.0f) ==> X
>
> in EarlyCSE. However, in the course of doing that I've had conversations
> with some ARM LLVM users who feel that they want to be
> able to have no simplification at all applied to floating point code, since
> for various different floating point implementations (CPU-scalar,
> CPU-vector, GPU) with various different rounding modes expressions like
> "fadd X, (-0.0f)" and "X" can have different values;
> even if this only happens in corner cases you'd not use in real code, from a
> testing point of view it makes things much more complicated.
> There's a reasonable view that, in some use cases, knowing that the code as
> written will be make it to machine code is more important
> than the occasional missed "acceptable" optimization.
>
> What would the community feel about the addition of a flag which led to the
> behaviour of not applying any simplification to
> floating point instructions (but only affecting those simplifications)? I
> should stress that we're not committing to implementing this,
> more getting a feel for if it's worth investigating feasibility some more.

I think it would be better to add more information to the IR so that the
optimizers can make correct decisions.  For example, LLVM has been lacking
proper support for rounding modes forever, maybe now is a good time to fix that?

Ciao, Duncan.



More information about the llvm-commits mailing list