aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index a4c56cc..87d64f1 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1469,6 +1469,17 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.PassByValueIsNoAlias = Args.hasArg(OPT_fpass_by_value_is_noalias);
+ // -f[no-]split-cold-code
+ // This may only be enabled when optimizing, and when small code size
+ // increases are tolerable.
+ Opts.SplitColdCode =
+ (Opts.OptimizationLevel > 0) && (Opts.OptimizeSize != 2) &&
+ Args.hasFlag(OPT_fsplit_cold_code, OPT_fno_split_cold_code, false);
+ if (Arg *A = Args.getLastArg(OPT_fsplit_cold_code))
+ if (!Opts.SplitColdCode)
+ Diags.Report(diag::warn_fe_ignored_opt_split_cold_code)
+ << A->getAsString(Args) << (Opts.OptimizeSize != 2);
+
return Success;
}