forked from OSchip/llvm-project
[Frontend] Simplify -finline* handling. NFC
This commit is contained in:
parent
ee7fb36ba0
commit
d74039fa8e
|
@ -1613,23 +1613,22 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
|
|||
|
||||
// At O0 we want to fully disable inlining outside of cases marked with
|
||||
// 'alwaysinline' that are required for correctness.
|
||||
Opts.setInlining((Opts.OptimizationLevel == 0)
|
||||
? CodeGenOptions::OnlyAlwaysInlining
|
||||
: CodeGenOptions::NormalInlining);
|
||||
// Explicit inlining flags can disable some or all inlining even at
|
||||
// optimization levels above zero.
|
||||
if (Arg *InlineArg = Args.getLastArg(
|
||||
options::OPT_finline_functions, options::OPT_finline_hint_functions,
|
||||
options::OPT_fno_inline_functions, options::OPT_fno_inline)) {
|
||||
if (Opts.OptimizationLevel > 0) {
|
||||
const Option &InlineOpt = InlineArg->getOption();
|
||||
if (InlineOpt.matches(options::OPT_finline_functions))
|
||||
Opts.setInlining(CodeGenOptions::NormalInlining);
|
||||
else if (InlineOpt.matches(options::OPT_finline_hint_functions))
|
||||
Opts.setInlining(CodeGenOptions::OnlyHintInlining);
|
||||
else
|
||||
Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining);
|
||||
}
|
||||
if (Opts.OptimizationLevel == 0) {
|
||||
Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining);
|
||||
} else if (const Arg *A = Args.getLastArg(options::OPT_finline_functions,
|
||||
options::OPT_finline_hint_functions,
|
||||
options::OPT_fno_inline_functions,
|
||||
options::OPT_fno_inline)) {
|
||||
// Explicit inlining flags can disable some or all inlining even at
|
||||
// optimization levels above zero.
|
||||
if (A->getOption().matches(options::OPT_finline_functions))
|
||||
Opts.setInlining(CodeGenOptions::NormalInlining);
|
||||
else if (A->getOption().matches(options::OPT_finline_hint_functions))
|
||||
Opts.setInlining(CodeGenOptions::OnlyHintInlining);
|
||||
else
|
||||
Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining);
|
||||
} else {
|
||||
Opts.setInlining(CodeGenOptions::NormalInlining);
|
||||
}
|
||||
|
||||
// PIC defaults to -fno-direct-access-external-data while non-PIC defaults to
|
||||
|
|
Loading…
Reference in New Issue