Commit 78a502ca by Martin Liska Committed by Martin Liska

Add Optimization keyword for param_max_inline_insns_auto param.

2019-11-14  Martin Liska  <mliska@suse.cz>

	* ipa-cp.c (devirtualization_time_bonus): Use opt_for_fn
	of a callee to get value of the param.
	* ipa-inline.c (inline_insns_auto): Use proper
	opt_for_fn.
	* opts.c (maybe_default_option): Do not overwrite param
	value if optimization level does not match.  Note that
	params usually have default value set via Init() keyword.
	* params.opt: Remove -param=max-inline-insns-auto-O2.
	* cif-code.def (MAX_INLINE_INSNS_AUTO_O2_LIMIT): Remove.
	* doc/invoke.texi: Remove documentation of
	max-inline-insns-auto-O2.
2019-11-14  Martin Liska  <mliska@suse.cz>

	* c-c++-common/asan/memcmp-1.c: Update expected backtrace.

From-SVN: r278218
parent 4c4503bf
2019-11-14 Martin Liska <mliska@suse.cz>
* ipa-cp.c (devirtualization_time_bonus): Use opt_for_fn
of a callee to get value of the param.
* ipa-inline.c (inline_insns_auto): Use proper
opt_for_fn.
* opts.c (maybe_default_option): Do not overwrite param
value if optimization level does not match. Note that
params usually have default value set via Init() keyword.
* params.opt: Remove -param=max-inline-insns-auto-O2.
* cif-code.def (MAX_INLINE_INSNS_AUTO_O2_LIMIT): Remove.
* doc/invoke.texi: Remove documentation of
max-inline-insns-auto-O2.
2019-11-14 Martin Liska <mliska@suse.cz>
* tree-switch-conversion.c (switch_conversion::switch_conversion):
Do not initialize m_other_count.
(switch_conversion::collect): Do not count m_default_count and
......@@ -74,8 +74,6 @@ DEFCIFCODE(MAX_INLINE_INSNS_SINGLE_O2_LIMIT, CIF_FINAL_NORMAL,
N_("--param max-inline-insns-single-O2 limit reached"))
DEFCIFCODE(MAX_INLINE_INSNS_AUTO_LIMIT, CIF_FINAL_NORMAL,
N_("--param max-inline-insns-auto limit reached"))
DEFCIFCODE(MAX_INLINE_INSNS_AUTO_O2_LIMIT, CIF_FINAL_NORMAL,
N_("--param max-inline-insns-auto-O2 limit reached"))
DEFCIFCODE(INLINE_UNIT_GROWTH_LIMIT, CIF_FINAL_NORMAL,
N_("--param inline-unit-growth limit reached"))
......
......@@ -11283,16 +11283,11 @@ applied. In other cases @option{max-inline-insns-single-O2} is applied.
@item max-inline-insns-auto
@item max-inline-insns-auto-O2
When you use @option{-finline-functions} (included in @option{-O3}),
a lot of functions that would otherwise not be considered for inlining
by the compiler are investigated. To those functions, a different
(more restrictive) limit compared to functions declared inline can
be applied.
For functions compiled with optimization levels
@option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-auto} is
applied. In other cases @option{max-inline-insns-auto-O2} is applied.
be applied (@option{--param max-inline-insns-auto}).
@item max-inline-insns-small
This is bound applied to calls which are considered relevant with
......@@ -11313,8 +11308,8 @@ execute function prologue and epilogue
@item inline-heuristics-hint-percent
@item inline-heuristics-hint-percent-O2
The scale (in percents) applied to @option{inline-insns-single},
@option{inline-insns-single-O2}, @option{inline-insns-auto},
@option{inline-insns-auto-O2} when inline heuristics hints that inlining is
@option{inline-insns-single-O2}, @option{inline-insns-auto}
when inline heuristics hints that inlining is
very profitable (will enable later optimizations).
For functions compiled with optimization levels
......@@ -2936,11 +2936,13 @@ devirtualization_time_bonus (struct cgraph_node *node,
int size = ipa_size_summaries->get (callee)->size;
/* FIXME: The values below need re-considering and perhaps also
integrating into the cost metrics, at lest in some very basic way. */
if (size <= param_max_inline_insns_auto / 4)
int max_inline_insns_auto
= opt_for_fn (callee->decl, param_max_inline_insns_auto);
if (size <= max_inline_insns_auto / 4)
res += 31 / ((int)speculative + 1);
else if (size <= param_max_inline_insns_auto / 2)
else if (size <= max_inline_insns_auto / 2)
res += 15 / ((int)speculative + 1);
else if (size <= param_max_inline_insns_auto
else if (size <= max_inline_insns_auto
|| DECL_DECLARED_INLINE_P (callee->decl))
res += 7 / ((int)speculative + 1);
}
......
......@@ -417,20 +417,10 @@ inline_insns_single (cgraph_node *n, bool hint)
static int
inline_insns_auto (cgraph_node *n, bool hint)
{
if (opt_for_fn (n->decl, optimize) >= 3)
{
int max_inline_insns_auto = opt_for_fn (n->decl, param_max_inline_insns_auto);
if (hint)
return param_max_inline_insns_auto
* param_inline_heuristics_hint_percent / 100;
return param_max_inline_insns_auto;
}
else
{
if (hint)
return param_max_inline_insns_auto_o2
* param_inline_heuristics_hint_percent_o2 / 100;
return param_max_inline_insns_auto_o2;
}
return max_inline_insns_auto * param_inline_heuristics_hint_percent / 100;
return max_inline_insns_auto;
}
/* Decide if we can inline the edge and possibly update
......
......@@ -388,7 +388,8 @@ maybe_default_option (struct gcc_options *opts,
lang_mask, DK_UNSPECIFIED, loc,
handlers, true, dc);
else if (default_opt->arg == NULL
&& !option->cl_reject_negative)
&& !option->cl_reject_negative
&& !(option->flags & CL_PARAMS))
handle_generated_option (opts, opts_set, default_opt->opt_index,
default_opt->arg, !default_opt->value,
lang_mask, DK_UNSPECIFIED, loc,
......@@ -541,6 +542,9 @@ static const struct default_options default_options_table[] =
{ OPT_LEVELS_3_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_DYNAMIC },
{ OPT_LEVELS_3_PLUS, OPT_fversion_loops_for_strides, NULL, 1 },
/* -O3 parameters. */
{ OPT_LEVELS_3_PLUS, OPT__param_max_inline_insns_auto_, NULL, 30 },
/* -Ofast adds optimizations to -O3. */
{ OPT_LEVELS_FAST, OPT_ffast_math, NULL, 1 },
{ OPT_LEVELS_FAST, OPT_fallow_store_data_races, NULL, 1 },
......
......@@ -467,11 +467,7 @@ Common Joined UInteger Var(param_max_hoist_depth) Init(30) Param
Maximum depth of search in the dominator tree for expressions to hoist.
-param=max-inline-insns-auto=
Common Joined UInteger Var(param_max_inline_insns_auto) Init(30) Param
The maximum number of instructions when automatically inlining with -O3 and -Ofast.
-param=max-inline-insns-auto-O2=
Common Joined UInteger Var(param_max_inline_insns_auto_o2) Init(15) Param
Common Joined UInteger Var(param_max_inline_insns_auto) Init(15) Optimization Param
The maximum number of instructions when automatically inlining.
-param=max-inline-insns-recursive=
......
2019-11-14 Martin Liska <mliska@suse.cz>
* c-c++-common/asan/memcmp-1.c: Update expected backtrace.
2019-11-14 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/gomp/declare-variant-11.c: Add "sse4.2" and "sse4.1"
......
......@@ -16,5 +16,5 @@ main ()
}
/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow.*(\n|\r\n|\r)" } */
/* { dg-output " #1 0x\[0-9a-f\]+ +(in _*(interceptor_|wrap_|)memcmp|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output " #2 0x\[0-9a-f\]+ +(in _*main|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output " #\[1-9\] 0x\[0-9a-f\]+ +(in _*(interceptor_|wrap_|)memcmp|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output " #\[2-9\] 0x\[0-9a-f\]+ +(in _*main|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment