llvm-project/clang/unittests/Frontend
Zahira Ammarguellat 84a9ec2ff1 Remove redundant option -menable-unsafe-fp-math.
There are currently two options that are used to tell the compiler to perform
unsafe floating-point optimizations:
'-ffast-math' and '-funsafe-math-optimizations'.

'-ffast-math' is enabled by default. It automatically enables the driver option
'-menable-unsafe-fp-math'.
Below is a table illustrating the special operations enabled automatically by
'-ffast-math', '-funsafe-math-optimizations' and '-menable-unsafe-fp-math'
respectively.

Special Operations -ffast-math	-funsafe-math-optimizations -menable-unsafe-fp-math
MathErrno	       0	         1	                    1
FiniteMathOnly         1 	         0                          0
AllowFPReassoc	       1         	 1                          1
NoSignedZero	       1                 1                          1
AllowRecip             1                 1                          1
ApproxFunc             1                 1                          1
RoundingMath	       0                 0                          0
UnsafeFPMath	       1                 0                          1
FPContract	       fast	         on	                    on

'-ffast-math' enables '-fno-math-errno', '-ffinite-math-only',
'-funsafe-math-optimzations' and sets 'FpContract' to 'fast'. The driver option
'-menable-unsafe-fp-math' enables the same special options than
'-funsafe-math-optimizations'. This is redundant.
We propose to remove the driver option '-menable-unsafe-fp-math' and use
instead, the setting of the special operations to set the function attribute
'unsafe-fp-math'. This attribute will be enabled only if those special
operations are enabled and if 'FPContract' is either 'fast' or set to the
default value.

Differential Revision: https://reviews.llvm.org/D135097
2022-10-14 10:55:29 -04:00
..
ASTUnitTest.cpp [clang] createInvocationFromCommandLine -> createInvocation, delete former. NFC 2022-05-06 16:21:48 +02:00
CMakeLists.txt [clangd] Avoid "expected one compiler job" by picking the first eligible job. 2021-08-13 00:36:30 +02:00
CodeGenActionTest.cpp [CGDebugInfo] Access the current working directory from the `VFS` 2022-07-26 13:48:39 -07:00
CompilerInstanceTest.cpp [clang] createInvocationFromCommandLine -> createInvocation, delete former. NFC 2022-05-06 16:21:48 +02:00
CompilerInvocationTest.cpp Remove redundant option -menable-unsafe-fp-math. 2022-10-14 10:55:29 -04:00
FixedPointString.cpp
FrontendActionTest.cpp PR51018: Remove explicit conversions from SmallString to StringRef to future-proof against C++23 2021-07-08 13:37:57 -07:00
OutputStreamTest.cpp Frontend: Fix memory leak in CompilerInstance::setVerboseOutputStream 2021-01-26 14:57:23 -08:00
PCHPreambleTest.cpp Fix a buglet in remove_dots(). 2022-06-02 11:07:44 -07:00
ParsedSourceLocationTest.cpp
TextDiagnosticTest.cpp [llvm] Add null-termination capability to SmallVectorMemoryBuffer 2021-12-09 11:32:13 +01:00
UtilsTest.cpp [Frontend] Flip default of CreateInvocationOptions::ProbePrecompiled to false 2022-05-10 16:58:13 +02:00