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

James Y Knight via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 15:55:51 PST 2024


jyknight wrote:

I think there is a bit of a problematic interaction with getDenormalModeForType [here](https://github.com/llvm/llvm-project/blob/7a94acb2da5b20d12f13f3c5f4eb0f3f46e78e73/clang/lib/Driver/ToolChains/Linux.cpp#L838C8-L838C37). "-shared" is (should be) a flag used only for linking, but that function is calling isFastMathRuntimeAvailable to affect the default denormal math mode for _compilation_. That's not going to work.

Probably we should effectively revert the x86-linux parts of fa7cd549d604bfd8f9dce5d649a19720cbc39cca.

I wonder if, instead, we should just have `-ffast-math` always downgrade `-fdenormal-fp-math=ieee` to `-fdenormal-fp-math=preserve-sign`, under the rationale of "you asked for fast math, and preserve-sign mode might let the compiler generate faster code"?

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


More information about the cfe-commits mailing list