diff options
author | Chad Rosier <mcrosier@apple.com> | 2013-04-24 18:09:54 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2013-04-24 18:09:54 +0000 |
commit | b82e117e4af1062b9f0d1aab89abf4aa804558f1 (patch) | |
tree | ad3bdc95ab05fc861302f79fa849457aa15dd2df /lib/Frontend/CompilerInvocation.cpp | |
parent | 0127b3f60b5bf7b8caed8426b8bd77c4a019a286 (diff) | |
download | clang-b82e117e4af1062b9f0d1aab89abf4aa804558f1.tar.gz |
[driver] Improve the implementation of the -Ofast option.
Specifically, allow the flags that fall under this umbrella (i.e., -O3,
-ffast-math, and -fstrict-aliasing) to be overridden/disabled with the
individual -O[0|1|2|s|z]/-fno- flags.
This also fixes the handling of various floating point optimization
flags that are modified by -ffast-math (and thus -Ofast as well).
Part of rdar://13622687
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180204 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index ba3809bba5..b5fb71e00f 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -100,13 +100,6 @@ static unsigned getOptimizationLevelSize(ArgList &Args) { return 0; } -static bool isOptimizationLevelFast(ArgList &Args) { - if (Arg *A = Args.getLastArg(options::OPT_O_Group)) - if (A->getOption().matches(options::OPT_Ofast)) - return true; - return false; -} - static void addWarningArgs(ArgList &Args, std::vector<std::string> &Warnings) { for (arg_iterator I = Args.filtered_begin(OPT_W_Group), E = Args.filtered_end(); I != E; ++I) { @@ -333,8 +326,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables); Opts.UseRegisterSizedBitfieldAccess = Args.hasArg( OPT_fuse_register_sized_bitfield_access); - Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing) || - isOptimizationLevelFast(Args); + Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing); Opts.StructPathTBAA = Args.hasArg(OPT_struct_path_tbaa); Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags); Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants); @@ -1313,8 +1305,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, // inlining enabled. Opts.NoInlineDefine = !Opt || Args.hasArg(OPT_fno_inline); - Opts.FastMath = Args.hasArg(OPT_ffast_math) || - isOptimizationLevelFast(Args); + Opts.FastMath = Args.hasArg(OPT_ffast_math); Opts.FiniteMathOnly = Args.hasArg(OPT_ffinite_math_only); Opts.RetainCommentsFromSystemHeaders = |