aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorMelanie Blower <melanie.blower@intel.com>2020-05-01 09:26:15 -0700
committerMelanie Blower <melanie.blower@intel.com>2020-05-01 10:03:30 -0700
commit69aacaf699922ffe0450f567e21208c10c84731f (patch)
treed497d3a99a0440c7f631ecf5a6f12878634c624e /clang/lib/Frontend/CompilerInvocation.cpp
parentd805ab7d039d6f3e7a8f7ab92e84c9d42a51ef66 (diff)
downloadllvm-69aacaf699922ffe0450f567e21208c10c84731f.zip
llvm-69aacaf699922ffe0450f567e21208c10c84731f.tar.gz
llvm-69aacaf699922ffe0450f567e21208c10c84731f.tar.bz2
Reapply "Add support for #pragma float_control" with improvements to
test cases Add support for #pragma float_control Reviewers: rjmccall, erichkeane, sepavloff Differential Revision: https://reviews.llvm.org/D72841 This reverts commit 85dc033caccaa6ab919d57f9759290be41240146, and makes corrections to the test cases that failed on buildbots.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index b327fa9..391f0e9 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2455,7 +2455,7 @@ static const StringRef GetInputKindName(InputKind IK) {
static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
const TargetOptions &TargetOpts,
- PreprocessorOptions &PPOpts,
+ PreprocessorOptions &PPOpts, CodeGenOptions &CGOpts,
DiagnosticsEngine &Diags) {
// FIXME: Cleanup per-file based stuff.
LangStandard::Kind LangStd = LangStandard::lang_unspecified;
@@ -3187,6 +3187,19 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) ||
Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
Args.hasArg(OPT_cl_fast_relaxed_math);
+ Opts.AllowFPReassoc = Opts.FastMath || CGOpts.Reassociate;
+ Opts.NoHonorNaNs =
+ Opts.FastMath || CGOpts.NoNaNsFPMath || Opts.FiniteMathOnly;
+ Opts.NoHonorInfs =
+ Opts.FastMath || CGOpts.NoInfsFPMath || Opts.FiniteMathOnly;
+ Opts.NoSignedZero = Opts.FastMath || CGOpts.NoSignedZeros;
+ Opts.AllowRecip = Opts.FastMath || CGOpts.ReciprocalMath;
+ // Currently there's no clang option to enable this individually
+ Opts.ApproxFunc = Opts.FastMath;
+ Opts.denormalIsIEEE =
+ !(CGOpts.FPDenormalMode.isValid() && CGOpts.FP32DenormalMode.isValid()) ||
+ (CGOpts.FPDenormalMode == llvm::DenormalMode::getIEEE() &&
+ CGOpts.FP32DenormalMode == llvm::DenormalMode::getIEEE());
if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
StringRef Val = A->getValue();
@@ -3640,7 +3653,7 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
// Other LangOpts are only initialized when the input is not AST or LLVM IR.
// FIXME: Should we really be calling this for an Language::Asm input?
ParseLangArgs(LangOpts, Args, DashX, Res.getTargetOpts(),
- Res.getPreprocessorOpts(), Diags);
+ Res.getPreprocessorOpts(), Res.getCodeGenOpts(), Diags);
if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)
LangOpts.ObjCExceptions = 1;
if (T.isOSDarwin() && DashX.isPreprocessed()) {