aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorKevin P. Neal <kevin.neal@sas.com>2020-07-10 08:46:09 -0400
committerKevin P. Neal <kevin.neal@sas.com>2020-07-10 08:49:45 -0400
commitd4ce862f2aa8b7e4b11462bd72014b08ab9468b3 (patch)
treed500e464b5d84d4c60c957139ceafe4c0a78f5d5 /clang/lib/Frontend/CompilerInvocation.cpp
parente1135b486aaed207f87a6d2e890678ef133b816e (diff)
downloadllvm-d4ce862f2aa8b7e4b11462bd72014b08ab9468b3.zip
llvm-d4ce862f2aa8b7e4b11462bd72014b08ab9468b3.tar.gz
llvm-d4ce862f2aa8b7e4b11462bd72014b08ab9468b3.tar.bz2
Reland "[FPEnv][Clang][Driver] Disable constrained floating point on targets lacking support."
We currently have strict floating point/constrained floating point enabled for all targets. Constrained SDAG nodes get converted to the regular ones before reaching the target layer. In theory this should be fine. However, the changes are exposed to users through multiple clang options already in use in the field, and the changes are _completely_ _untested_ on almost all of our targets. Bugs have already been found, like "https://bugs.llvm.org/show_bug.cgi?id=45274". This patch disables constrained floating point options in clang everywhere except X86 and SystemZ. A warning will be printed when this happens. Use the new -fexperimental-strict-floating-point flag to force allowing strict floating point on hosts that aren't already marked as supporting it (X86 and SystemZ). Differential Revision: https://reviews.llvm.org/D80952
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 64dcfa8..e24de29 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3281,6 +3281,9 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
}
+ if (Args.hasArg(OPT_fexperimental_strict_floating_point))
+ Opts.ExpStrictFP = true;
+
auto FPRM = llvm::RoundingMode::NearestTiesToEven;
if (Args.hasArg(OPT_frounding_math)) {
FPRM = llvm::RoundingMode::Dynamic;