diff options
author | Zahira Ammarguellat <zahira.ammarguellat@intel.com> | 2022-11-07 13:54:42 -0500 |
---|---|---|
committer | Zahira Ammarguellat <zahira.ammarguellat@intel.com> | 2022-11-11 10:24:12 -0500 |
commit | 91628f0616ca5203945afb56b3d8a27522b99808 (patch) | |
tree | bb0ab9a4ac858c518db540009d50020eec1f09dc /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 2116d69f100c243069be1e76ac7fdac65ea5328a (diff) | |
download | llvm-91628f0616ca5203945afb56b3d8a27522b99808.zip llvm-91628f0616ca5203945afb56b3d8a27522b99808.tar.gz llvm-91628f0616ca5203945afb56b3d8a27522b99808.tar.bz2 |
The handling of 'funsafe-math-optimizations' doesn't update the 'MathErrno'
flag. But the driver checks for 'fno-math-errno' before passing
'funsafe-math-optimizations' to the FE. In GCC, the option
'funsafe-math-optimizations' doesn't affect the 'fmath-errno' flag.
This patch aligns clang with GCC.
'-ffast-math' sets the FPContract to 'fast'. But 'funsafe-math-optimizations'
the driver doesn't consider the FPContract when handling the option.
Unfortunately there are places in the BE that interpret unsafe math
mode as allowing FMA. This patch makes -ffast-math' and
'funsafe-math-optimizations' behave similarly in regard to the setting of the
FPContract.
Differential Revision: https://reviews.llvm.org/D137578
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 088e83b..40d556f 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3799,7 +3799,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, else Opts.LongDoubleSize = 0; } - if (Opts.FastRelaxedMath) + if (Opts.FastRelaxedMath || Opts.CLUnsafeMath) Opts.setDefaultFPContractMode(LangOptions::FPM_Fast); llvm::sort(Opts.ModuleFeatures); |