mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
Meta: Globally disable floating point contraction
FP contraction is a standard-conforming behavior which allows the compiler to calculate intermediate results of expressions containing floating point numbers with a greater precision than the expression type allows. And in theory, it enables additional optimizations, such as replacing `a * b + c` with fma(a, b, c). Unfortunately, it is extremely hard to predict when the contraction will happen. For example, Clang 17 on x86_64 with the default options will use FMA only for constant-folded non-constexpr expressions. So, in practice, FP contraction leads to hard-to-find bugs and inconsistencies between executables compiled with different toolchains or for different OSes. And we had two instances of this happening last week. Since we did not ever used -mfma on x86_64, this patch can only possibly regress performance on Apple ARM devices, where FMA is enabled by default. However, this regression will likely be negligible since the difference would be one additional add instruction, which would be then likely executed in parallel with something else.
This commit is contained in:
parent
67bc7cecbb
commit
2dba79bc6b
Notes:
sideshowbarker
2024-07-16 23:51:07 +09:00
Author: https://github.com/DanShaders Commit: https://github.com/SerenityOS/serenity/commit/2dba79bc6b Pull-request: https://github.com/SerenityOS/serenity/pull/21963 Reviewed-by: https://github.com/trflynn89 ✅
@ -12,6 +12,8 @@ add_compile_options(-Wno-unused-command-line-argument)
|
||||
add_compile_options(-fdiagnostics-color=always)
|
||||
add_compile_options(-fno-exceptions)
|
||||
|
||||
add_compile_options(-ffp-contract=off)
|
||||
|
||||
if (NOT CMAKE_HOST_SYSTEM_NAME MATCHES SerenityOS)
|
||||
# FIXME: Something makes this go crazy and flag unused variables that aren't flagged as such when building with the toolchain.
|
||||
# Disable -Werror for now.
|
||||
|
@ -84,6 +84,8 @@ config("compiler_defaults") {
|
||||
}
|
||||
cflags += [ "-fdiagnostics-color" ]
|
||||
|
||||
cflags += [ "-ffp-contract=off" ]
|
||||
|
||||
if (use_lld) {
|
||||
ldflags += [ "-Wl,--color-diagnostics" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user