[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 8 15:26:43 PST 2024


andykaylor wrote:

> > I don't see why the current denormal-fp-math setting behavior is a blocking issue for this change
> 
> Because this PR as-is causes us to start parsing the "-shared" flag for compilation actions in order to determine which denormal-fp-math setting to use. Users should not pass that to compile actions, and if they do, it should result in a `-Wunused-command-line-argument` diagnostic, NOT a behavior change.

We're already parsing -nostartfiles and -nostdlib to determine the default setting. I don't see how looking at -shared makes it any worse.

I would agree that this whole model is broken. If I use -ffast-math to create a bunch of object files (including the one containing main()) and then I link without that option, crtfastmath.o doesn't get linked, even though we used "denorm-fp-math"="preserveSign" on every function.

I think we're in agreement that this needs to be fixed for x86-based targets. We just need to agree on how to do it. I think https://github.com/llvm/llvm-project/issues/57589 is a pretty egregious problem, and I'd like to see it fixed without delay, but given that it requires setting -ffast-math on your link line maybe it can wait for a proper fix.

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


More information about the cfe-commits mailing list