aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorMelanie Blower <melanie.blower@intel.com>2020-05-01 10:32:06 -0700
committerMelanie Blower <melanie.blower@intel.com>2020-05-04 05:51:25 -0700
commitf5360d4bb3376347479d86547d21b95d80be786d (patch)
tree2b0aea0b2e02617572187f640570a8c9fc1c1f92 /clang/lib/Frontend/CompilerInvocation.cpp
parent67b466deda1dcee2ba4bea8ad3579415df678249 (diff)
downloadllvm-f5360d4bb3376347479d86547d21b95d80be786d.zip
llvm-f5360d4bb3376347479d86547d21b95d80be786d.tar.gz
llvm-f5360d4bb3376347479d86547d21b95d80be786d.tar.bz2
Reapply "Add support for #pragma float_control" with buildbot fixes
Add support for #pragma float_control Reviewers: rjmccall, erichkeane, sepavloff Differential Revision: https://reviews.llvm.org/D72841 This reverts commit fce82c0ed310174fe48e2402ac731b6340098389.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index b327fa9..35c58da 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,15 @@ 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;
if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
StringRef Val = A->getValue();
@@ -3640,7 +3649,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()) {