Commit ae6e6a08 by Jan Hubicka Committed by Jan Hubicka

ipa-inline.c (leaf_node_p): Rename to ...

	* ipa-inline.c (leaf_node_p): Rename to ...
	(num_calls) ... this one.
	(want_early_inline_function_p): Allow smal growth on non-leafs.

From-SVN: r193157
parent dcda5cc8
2012-11-05 Jan Hubicka <jh@suse.cz>
* ipa-inline.c (leaf_node_p): Rename to ...
(num_calls) ... this one.
(want_early_inline_function_p): Allow smal growth on non-leafs.
2012-11-05 Jakub Jelinek <jakub@redhat.com> 2012-11-05 Jakub Jelinek <jakub@redhat.com>
PR debug/54402 PR debug/54402
...@@ -380,17 +380,18 @@ can_early_inline_edge_p (struct cgraph_edge *e) ...@@ -380,17 +380,18 @@ can_early_inline_edge_p (struct cgraph_edge *e)
} }
/* Return true when N is leaf function. Accept cheap builtins /* Return number of calls in N. Ignore cheap builtins. */
in leaf functions. */
static bool static int
leaf_node_p (struct cgraph_node *n) num_calls (struct cgraph_node *n)
{ {
struct cgraph_edge *e; struct cgraph_edge *e;
int num = 0;
for (e = n->callees; e; e = e->next_callee) for (e = n->callees; e; e = e->next_callee)
if (!is_inexpensive_builtin (e->callee->symbol.decl)) if (!is_inexpensive_builtin (e->callee->symbol.decl))
return false; num++;
return true; return num;
} }
...@@ -414,6 +415,8 @@ want_early_inline_function_p (struct cgraph_edge *e) ...@@ -414,6 +415,8 @@ want_early_inline_function_p (struct cgraph_edge *e)
else else
{ {
int growth = estimate_edge_growth (e); int growth = estimate_edge_growth (e);
int n;
if (growth <= 0) if (growth <= 0)
; ;
else if (!cgraph_maybe_hot_edge_p (e) else if (!cgraph_maybe_hot_edge_p (e)
...@@ -427,22 +430,23 @@ want_early_inline_function_p (struct cgraph_edge *e) ...@@ -427,22 +430,23 @@ want_early_inline_function_p (struct cgraph_edge *e)
growth); growth);
want_inline = false; want_inline = false;
} }
else if (!leaf_node_p (callee) else if (growth > PARAM_VALUE (PARAM_EARLY_INLINING_INSNS))
&& growth > 0)
{ {
if (dump_file) if (dump_file)
fprintf (dump_file, " will not early inline: %s/%i->%s/%i, " fprintf (dump_file, " will not early inline: %s/%i->%s/%i, "
"callee is not leaf and code would grow by %i\n", "growth %i exceeds --param early-inlining-insns\n",
xstrdup (cgraph_node_name (e->caller)), e->caller->uid, xstrdup (cgraph_node_name (e->caller)), e->caller->uid,
xstrdup (cgraph_node_name (callee)), callee->uid, xstrdup (cgraph_node_name (callee)), callee->uid,
growth); growth);
want_inline = false; want_inline = false;
} }
else if (growth > PARAM_VALUE (PARAM_EARLY_INLINING_INSNS)) else if ((n = num_calls (callee)) != 0
&& growth * (n + 1) > PARAM_VALUE (PARAM_EARLY_INLINING_INSNS))
{ {
if (dump_file) if (dump_file)
fprintf (dump_file, " will not early inline: %s/%i->%s/%i, " fprintf (dump_file, " will not early inline: %s/%i->%s/%i, "
"growth %i exceeds --param early-inlining-insns\n", "growth %i exceeds --param early-inlining-insns "
"divided by number of calls\n",
xstrdup (cgraph_node_name (e->caller)), e->caller->uid, xstrdup (cgraph_node_name (e->caller)), e->caller->uid,
xstrdup (cgraph_node_name (callee)), callee->uid, xstrdup (cgraph_node_name (callee)), callee->uid,
growth); growth);
......
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