[clang] [Driver] Introduce ffp-model=aggressive (PR #100453)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 19 10:31:28 PDT 2024


andykaylor wrote:

> > @MaskRay Are you OK with this change?
> 
> Sorry for the delay. I've read through https://discourse.llvm.org/t/making-ffp-model-fast-more-user-friendly/78402, how we ended up with `-ffp-contract=fast-honor-pragmas` beside `=fast` (GCC compatibility, sigh), some notes that ICC/GCC have behavior differences. A different, safer mode for `-ffp-model` (absent from GCC) makes sense to me.

GCC doesn't support the pragma, and ICC doesn't have a mode that only allows contraction within a single expression (as the C standard requires), so I don't think compatibility with the behavior of the pragma in those compilers makes sense.

I personally feel very strongly that even our -ffast-math handling should honor pragmas by default and that -ffp-contract=fast should honor pragmas (perhaps with the addition of -ffp-contract=fast-no-honor-pragmas if anyone really needs that). Someone else was surprised by this behavior earlier this year (https://github.com/llvm/llvm-project/issues/88633). On the other hand, we've got a bug in the front end where we crash with "#pragma STDC FP_CONTRACT DEFAULT" if you've used "-ffp-contract=fast-honor-pragmas" (https://godbolt.org/z/EqE6Kn6Wf) so maybe I should hold the fp-contract change back for a future patch.

https://github.com/llvm/llvm-project/pull/100453


More information about the cfe-commits mailing list