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

James Y Knight via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 07:45:39 PST 2024


jyknight wrote:

> So, alternatively...we could just go with the simplest solution, and use "ieee" as the default even under -ffast-math.

This is feeling like the best option to me, at this point. Easily implementable, and doesn't seem to make things significantly worse than they are today, since the denormal mode can't be controlled by compilation options -- so being wrong in both directions is going to happen, anyhow.

We'd simply delete [Linux::getDefaultDenormalModeForType](https://github.com/llvm/llvm-project/blob/d4c5acac99e83ffa12d2d720c9e502a181cbd7ea/clang/lib/Driver/ToolChains/Linux.cpp#L838), which thus causes `-ffast-math` to simply not change the compiler's understanding of denormals handling -- like is already the case on everything except x86/x86_64 Linux.

Other more-involved changes, such as exposing "-fdenormal-fp-math=dynamic" in Clang, and potentially making it the default, could be done later if desired. I'd suggest that this change doesn't need to block on any such discussions.

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


More information about the cfe-commits mailing list