Commit f256c274 by Jan Hubicka Committed by Jan Hubicka

invoke.texi (max-inline-insns-small): New parameters.


	* doc/invoke.texi (max-inline-insns-small): New parameters.
	* ipa-inline.c (want_early_inline_function_p): simplify.
	(want_inline_small_function_p): Fix pasto from previous patch;
	use max-inline-insns-small bound.
	* params.def (max-inline-insns-small): New param.
	* ipa-fnsummary.c (analyze_function_body): Initialize time/size
	variables correctly.

From-SVN: r267603
parent beb04ce9
2019-01-05 Jan Hubicka <hubicka@ucw.cz> 2019-01-05 Jan Hubicka <hubicka@ucw.cz>
* doc/invoke.texi (max-inline-insns-small): New parameters.
* ipa-inline.c (want_early_inline_function_p): simplify.
(want_inline_small_function_p): Fix pasto from previous patch;
use max-inline-insns-small bound.
* params.def (max-inline-insns-small): New param.
* ipa-fnsummary.c (analyze_function_body): Initialize time/size
variables correctly.
2019-01-05 Jan Hubicka <hubicka@ucw.cz>
* doc/invoke.texi: Document max-inline-insns-size, * doc/invoke.texi: Document max-inline-insns-size,
uninlined-function-insns, uninlined-function-time, uninlined-function-insns, uninlined-function-time,
uninlined-thunk-insns and uninlined-thunk-time. uninlined-thunk-insns and uninlined-thunk-time.
......
...@@ -11007,6 +11007,10 @@ by the compiler are investigated. To those functions, a different ...@@ -11007,6 +11007,10 @@ by the compiler are investigated. To those functions, a different
(more restrictive) limit compared to functions declared inline can (more restrictive) limit compared to functions declared inline can
be applied. be applied.
@item max-inline-insns-small
This is bound applied to calls which are considered relevant with
@option{-finline-small-functions}.
@item max-inline-insns-size @item max-inline-insns-size
This is bound applied to calls which are optimized for size. Small growth This is bound applied to calls which are optimized for size. Small growth
may be desirable to anticipate optimization oppurtunities exposed by inlining. may be desirable to anticipate optimization oppurtunities exposed by inlining.
...@@ -1969,9 +1969,9 @@ fp_expression_p (gimple *stmt) ...@@ -1969,9 +1969,9 @@ fp_expression_p (gimple *stmt)
static void static void
analyze_function_body (struct cgraph_node *node, bool early) analyze_function_body (struct cgraph_node *node, bool early)
{ {
sreal time = 0; sreal time = PARAM_VALUE (PARAM_UNINLINED_FUNCTION_TIME);
/* Estimate static overhead for function prologue/epilogue and alignment. */ /* Estimate static overhead for function prologue/epilogue and alignment. */
int size = 2; int size = PARAM_VALUE (PARAM_UNINLINED_FUNCTION_INSNS);
/* Benefits are scaled by probability of elimination that is in range /* Benefits are scaled by probability of elimination that is in range
<0,2>. */ <0,2>. */
basic_block bb; basic_block bb;
......
...@@ -637,8 +637,7 @@ want_early_inline_function_p (struct cgraph_edge *e) ...@@ -637,8 +637,7 @@ want_early_inline_function_p (struct cgraph_edge *e)
if (growth <= PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SIZE)) if (growth <= PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SIZE))
; ;
else if (!e->maybe_hot_p () else if (!e->maybe_hot_p ())
&& growth > 0)
{ {
if (dump_enabled_p ()) if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt, dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
...@@ -791,7 +790,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report) ...@@ -791,7 +790,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
ipa_hints hints = estimate_edge_hints (e); ipa_hints hints = estimate_edge_hints (e);
int big_speedup = -1; /* compute this lazily */ int big_speedup = -1; /* compute this lazily */
if (growth <= PARAM_VALUE (PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SIZE))) if (growth <= PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SIZE))
; ;
/* Apply MAX_INLINE_INSNS_SINGLE limit. Do not do so when /* Apply MAX_INLINE_INSNS_SINGLE limit. Do not do so when
hints suggests that inlining given function is very profitable. */ hints suggests that inlining given function is very profitable. */
...@@ -809,9 +808,8 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report) ...@@ -809,9 +808,8 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
want_inline = false; want_inline = false;
} }
else if (!DECL_DECLARED_INLINE_P (callee->decl) else if (!DECL_DECLARED_INLINE_P (callee->decl)
&& (in_lto_p && !opt_for_fn (e->caller->decl, flag_inline_functions)
&& growth >= PARAM_VALUE (PARAM_EARLY_INLINING_INSNS)) && growth >= PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SMALL))
&& !opt_for_fn (e->caller->decl, flag_inline_functions))
{ {
/* growth_likely_positive is expensive, always test it last. */ /* growth_likely_positive is expensive, always test it last. */
if (growth >= MAX_INLINE_INSNS_SINGLE if (growth >= MAX_INLINE_INSNS_SINGLE
......
...@@ -83,6 +83,11 @@ DEFPARAM (PARAM_MAX_INLINE_INSNS_AUTO, ...@@ -83,6 +83,11 @@ DEFPARAM (PARAM_MAX_INLINE_INSNS_AUTO,
"The maximum number of instructions when automatically inlining.", "The maximum number of instructions when automatically inlining.",
30, 0, 0) 30, 0, 0)
DEFPARAM (PARAM_MAX_INLINE_INSNS_SMALL,
"max-inline-insns-small",
"The maximum number of instructions when automatically inlining small functions.",
0, 0, 0)
DEFPARAM (PARAM_MAX_INLINE_INSNS_SIZE, DEFPARAM (PARAM_MAX_INLINE_INSNS_SIZE,
"max-inline-insns-size", "max-inline-insns-size",
"The maximum number of instructions when inlining for size.", "The maximum number of instructions when inlining for size.",
......
2019-01-05 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/ipa/ipcp-2.c: Update bounds.
2019-01-05 Dominique d'Humieres <dominiq@gcc.gnu.org> 2019-01-05 Dominique d'Humieres <dominiq@gcc.gnu.org>
* gcc.dg/plugin/plugindir1.c: Adjust dg-prune-output for Darwin. * gcc.dg/plugin/plugindir1.c: Adjust dg-prune-output for Darwin.
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining --param ipa-cp-eval-threshold=80" } */ /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining --param ipa-cp-eval-threshold=200" } */
/* { dg-add-options bind_pic_locally } */ /* { dg-add-options bind_pic_locally } */
extern int get_stuff (int); extern int get_stuff (int);
......
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