aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorZahira Ammarguellat <zahira.ammarguellat@intel.com>2022-11-07 13:54:42 -0500
committerZahira Ammarguellat <zahira.ammarguellat@intel.com>2022-11-11 10:24:12 -0500
commit91628f0616ca5203945afb56b3d8a27522b99808 (patch)
treebb0ab9a4ac858c518db540009d50020eec1f09dc /clang/lib/Frontend/CompilerInvocation.cpp
parent2116d69f100c243069be1e76ac7fdac65ea5328a (diff)
downloadllvm-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.cpp2
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);