[all-commits] [llvm/llvm-project] 46de93: Option to control signaling NaN support
Serge Pavlov via All-commits
all-commits at lists.llvm.org
Thu Jul 16 02:03:03 PDT 2026
Branch: refs/heads/users/spavloff/snan
Home: https://github.com/llvm/llvm-project
Commit: 46de9326f62b4d7eec5cd832221f7af11ad98128
https://github.com/llvm/llvm-project/commit/46de9326f62b4d7eec5cd832221f7af11ad98128
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M clang/docs/ReleaseNotes.md
M clang/docs/UsersManual.md
M clang/include/clang/Basic/CodeGenOptions.def
M clang/include/clang/Basic/TargetInfo.h
M clang/include/clang/Options/Options.td
M clang/lib/Basic/TargetInfo.cpp
M clang/lib/Basic/Targets/AArch64.cpp
M clang/lib/Basic/Targets/PPC.h
M clang/lib/Basic/Targets/RISCV.h
M clang/lib/Basic/Targets/SystemZ.h
M clang/lib/Basic/Targets/X86.h
M clang/lib/CodeGen/CodeGenFunction.cpp
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/lib/Frontend/InitPreprocessor.cpp
A clang/test/CodeGen/attr-signaling-nans.c
M clang/test/CodeGenOpenCL/cl20-device-side-enqueue-attributes.cl
M clang/test/Driver/clang_f_opts.c
M clang/test/Driver/fast-math.c
M llvm/docs/ReleaseNotes.md
M llvm/include/llvm/Analysis/SimplifyQuery.h
M llvm/include/llvm/IR/FPEnv.h
M llvm/lib/Analysis/InstructionSimplify.cpp
M llvm/test/Transforms/InstSimplify/strictfp-fadd.ll
M llvm/test/Transforms/InstSimplify/strictfp-fsub.ll
Log Message:
-----------
Option to control signaling NaN support
This change implements the Clang command-line option `-fsignaling-nans`,
which is a counterpart of the GCC option with the same name. It allows a
user to control support for signaling NaNs. This option instructs the
compiler that signaling NaNs are to be treated according to IEEE 754:
they are quieted in arithmetic operations and raise `Invalid`
floating-point exception. The opposite option, `-fno-signaling-nans`,
does the reverse, - it indicates that signaling NaNs are handled
identically to quiet NaNs. If neither of these options is specified, no
signaling NaNs support is assumed, except for functions that have
`strictfp` attribute.
At the IR level, signaling NaN support is represented by the function
attribute "signaling-nans". It is set by Clang when it generates code in
cases when signaling NaNs are supported. If the target architecture does
not support signaling NaNs, Clang does not set this attribute.
The primary motivation for this change is the optimization of strictfp
code. When signaling NaN support is present, it can hinder optimization
in some cases. For example, the transformation `x * 1.0 -> x` is not
valid. Additionally, many intrinsic functions, like `trunc`, do not
raise floating-point exceptions other than those caused by signaling
NaNs, which can be beneficial for optimizations. The previous model
assumed that signaling NaNs are always supported in strictfp functions.
However, some hardware do not implement full support of signaling NaNs
and do not distinguish between quiet and signaling NaNs. It also can be
profitable to the skip signaling NaN support to enable more optimizations,
if the user can guarantee that signaling NaNs cannot be encountered in
their program.
Commit: 939bb7f722a7b48825f65f48259551c1e30f133e
https://github.com/llvm/llvm-project/commit/939bb7f722a7b48825f65f48259551c1e30f133e
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M clang/docs/UsersManual.md
M clang/include/clang/Basic/TargetInfo.h
M clang/lib/CodeGen/CodeGenFunction.cpp
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/test/Driver/fp-model.c
M clang/test/Preprocessor/predefined-macros.c
M llvm/include/llvm/Analysis/SimplifyQuery.h
M llvm/include/llvm/Bitcode/LLVMBitCodes.h
M llvm/include/llvm/IR/Attributes.td
M llvm/include/llvm/IR/FPEnv.h
M llvm/include/llvm/IR/Function.h
M llvm/lib/Analysis/InstructionSimplify.cpp
M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
M llvm/lib/IR/Attributes.cpp
M llvm/test/Bitcode/attributes.ll
A llvm/test/Transforms/Inline/inline-signaling-nans.ll
M llvm/test/Transforms/InstSimplify/strictfp-fadd.ll
M llvm/test/Transforms/InstSimplify/strictfp-fsub.ll
Log Message:
-----------
Update according to the feedback
- Optimizations using the new attribute are removed.
- Use a separate Attribute kind rather than string.
- Implemented merging the attribute when inlining.
- Added some tests.
- Fixed documentation.
Commit: 71d71d6360d240437cef475e505db5111dee8052
https://github.com/llvm/llvm-project/commit/71d71d6360d240437cef475e505db5111dee8052
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M clang/test/CodeGen/attr-signaling-nans.c
M clang/test/CodeGen/fp-floatcontrol-stack.cpp
M clang/test/CodeGenOpenCL/cl20-device-side-enqueue-attributes.cl
M clang/test/Options/Gis.hlsl
M llvm/include/llvm/IR/Attributes.td
M llvm/lib/IR/Attributes.cpp
Log Message:
-----------
Fix tests and documentation
Also changes intersect behavior to IntersectPreserve, because
IntersectCustom is implemented only forIntAttr.
Commit: 39f495d76e639330b729017519774776a10f7a68
https://github.com/llvm/llvm-project/commit/39f495d76e639330b729017519774776a10f7a68
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M clang/docs/UsersManual.md
M clang/include/clang/Basic/CodeGenOptions.def
M clang/include/clang/Options/Options.td
M clang/lib/CodeGen/CodeGenFunction.cpp
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/test/CodeGen/attr-signaling-nans.c
M clang/test/CodeGen/fp-floatcontrol-stack.cpp
M clang/test/CodeGenOpenCL/cl20-device-side-enqueue-attributes.cl
M clang/test/Driver/clang_f_opts.c
M clang/test/Driver/fp-model.c
M clang/test/Preprocessor/predefined-macros.c
Log Message:
-----------
Remove default setting signaling_nan attribute for strictfp functions
We cannot describe such behavior in Clang User Manual, strictfp is not
visible for a user.
Commit: 906a85d270fea55b4d40dda5c098b608ab3a4edf
https://github.com/llvm/llvm-project/commit/906a85d270fea55b4d40dda5c098b608ab3a4edf
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M clang/include/clang/Basic/DiagnosticFrontendKinds.td
M clang/lib/Frontend/CompilerInstance.cpp
M clang/test/CodeGen/attr-signaling-nans.c
Log Message:
-----------
Issue a warning if signaling-nans is requested but not supported
Commit: 84f7b22dde27988da97ae49dea6da179106c6afe
https://github.com/llvm/llvm-project/commit/84f7b22dde27988da97ae49dea6da179106c6afe
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M llvm/lib/Transforms/Utils/CodeExtractor.cpp
Log Message:
-----------
Fix warning
Commit: a00f2053ce82a0e894b3c3bfd31432830418fdbf
https://github.com/llvm/llvm-project/commit/a00f2053ce82a0e894b3c3bfd31432830418fdbf
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M flang/test/Driver/flang-f-opts.f90
Log Message:
-----------
Attempt to fix flang test
Commit: 02ab7694f7a124bb028a3e91509cbee0263eb5b5
https://github.com/llvm/llvm-project/commit/02ab7694f7a124bb028a3e91509cbee0263eb5b5
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M clang/docs/UsersManual.md
M clang/include/clang/Basic/CodeGenOptions.def
M clang/include/clang/Options/Options.td
M clang/lib/CodeGen/CodeGenFunction.cpp
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/test/CodeGen/attr-signaling-nans.c
M clang/test/CodeGen/fp-floatcontrol-stack.cpp
M clang/test/Driver/clang_f_opts.c
M clang/test/Driver/fp-model.c
M clang/test/Preprocessor/predefined-macros.c
Log Message:
-----------
Revert "Remove default setting signaling_nan attribute for strictfp functions"
Restore the previous behavior, where a strictfp function implicitly got
the `singaling_nans` attribute. Difficulty in explaining the behavior to
users is not an acceptable reason for changing the default behavior.
Previously, this behavior was also undocumented. Assuming
`signaling_nans` by default in `strictfp` functions is safer and
maintains compatibility.
This reverts commit 1c9601c52e8f396d024e4c3032047dce87b288b8.
Commit: dc6e174838ecabf0eb08d1236f8f570171d52119
https://github.com/llvm/llvm-project/commit/dc6e174838ecabf0eb08d1236f8f570171d52119
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M clang/docs/UsersManual.md
Log Message:
-----------
Fix documentation
Commit: 42f201c00da09aa3ed85010601835216eb1d7f9c
https://github.com/llvm/llvm-project/commit/42f201c00da09aa3ed85010601835216eb1d7f9c
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M clang/docs/UsersManual.md
M llvm/docs/LangRef.md
Log Message:
-----------
Fix documentation after rebase
Compare: https://github.com/llvm/llvm-project/compare/c5dbfb76f9d1...42f201c00da0
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list