Commit 09dfe187 by Jan Hubicka Committed by Jan Hubicka

ipa-inline.c (caller_growth_limits): Fix thinko when

	* ipa-inline.c (caller_growth_limits): Fix thinko when
	* ipa-inline.c (caller_growth_limits): Fix thinko when
	looking for largest stack frame.
	* ipa-inline.h (dump_inline_summary): Declare.
	* ipa-inline-analysis.c (dump_inline_edge_summary): Dump info
	on stack usage.
	(dump_inline_summary): Export.
	(debug_inline_summary): Declare as DEBUG_FUNCTION.

From-SVN: r173234
parent 12c0e385
2011-05-01 Jan Hubicka <jh@suse.cz>
* ipa-inline.c (caller_growth_limits): Fix thinko when
looking for largest stack frame.
* ipa-inline.h (dump_inline_summary): Declare.
* ipa-inline-analysis.c (dump_inline_edge_summary): Dump info
on stack usage.
(dump_inline_summary): Export.
(debug_inline_summary): Declare as DEBUG_FUNCTION.
2011-05-01 Anatoly Sokolov <aesok@post.ru> 2011-05-01 Anatoly Sokolov <aesok@post.ru>
* reginfo.c (memory_move_cost): Change rclass argument type form * reginfo.c (memory_move_cost): Change rclass argument type form
......
...@@ -735,7 +735,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, ...@@ -735,7 +735,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
for (edge = node->callees; edge; edge = edge->next_callee) for (edge = node->callees; edge; edge = edge->next_callee)
{ {
struct inline_edge_summary *es = inline_edge_summary (edge); struct inline_edge_summary *es = inline_edge_summary (edge);
fprintf (f, "%*s%s/%i %s\n%*s loop depth:%2i freq:%4i size:%2i time: %2i", fprintf (f, "%*s%s/%i %s\n%*s loop depth:%2i freq:%4i size:%2i time: %2i callee size:%2i stack:%2i",
indent, "", cgraph_node_name (edge->callee), indent, "", cgraph_node_name (edge->callee),
edge->callee->uid, edge->callee->uid,
!edge->inline_failed ? "inlined" !edge->inline_failed ? "inlined"
...@@ -744,7 +744,9 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, ...@@ -744,7 +744,9 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
es->loop_depth, es->loop_depth,
edge->frequency, edge->frequency,
es->call_stmt_size, es->call_stmt_size,
es->call_stmt_time); es->call_stmt_time,
(int)inline_summary (edge->callee)->size,
(int)inline_summary (edge->callee)->estimated_stack_size);
if (es->predicate) if (es->predicate)
{ {
fprintf (f, " predicate: "); fprintf (f, " predicate: ");
...@@ -753,7 +755,14 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, ...@@ -753,7 +755,14 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
else else
fprintf (f, "\n"); fprintf (f, "\n");
if (!edge->inline_failed) if (!edge->inline_failed)
dump_inline_edge_summary (f, indent+2, edge->callee, info); {
fprintf (f, "%*sStack frame offset %i, callee self size %i, callee size %i\n",
indent+2, "",
(int)inline_summary (edge->callee)->stack_frame_offset,
(int)inline_summary (edge->callee)->estimated_self_stack_size,
(int)inline_summary (edge->callee)->estimated_stack_size);
dump_inline_edge_summary (f, indent+2, edge->callee, info);
}
} }
for (edge = node->indirect_calls; edge; edge = edge->next_callee) for (edge = node->indirect_calls; edge; edge = edge->next_callee)
{ {
...@@ -775,7 +784,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, ...@@ -775,7 +784,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
} }
static void void
dump_inline_summary (FILE * f, struct cgraph_node *node) dump_inline_summary (FILE * f, struct cgraph_node *node)
{ {
if (node->analyzed) if (node->analyzed)
...@@ -816,7 +825,7 @@ dump_inline_summary (FILE * f, struct cgraph_node *node) ...@@ -816,7 +825,7 @@ dump_inline_summary (FILE * f, struct cgraph_node *node)
} }
} }
void DEBUG_FUNCTION void
debug_inline_summary (struct cgraph_node *node) debug_inline_summary (struct cgraph_node *node)
{ {
dump_inline_summary (stderr, node); dump_inline_summary (stderr, node);
......
...@@ -151,7 +151,7 @@ caller_growth_limits (struct cgraph_edge *e) ...@@ -151,7 +151,7 @@ caller_growth_limits (struct cgraph_edge *e)
we immediately inline to. This is the most relaxed we immediately inline to. This is the most relaxed
interpretation of the rule "do not grow large functions interpretation of the rule "do not grow large functions
too much in order to prevent compiler from exploding". */ too much in order to prevent compiler from exploding". */
do while (true)
{ {
info = inline_summary (to); info = inline_summary (to);
if (limit < info->self_size) if (limit < info->self_size)
...@@ -160,8 +160,9 @@ caller_growth_limits (struct cgraph_edge *e) ...@@ -160,8 +160,9 @@ caller_growth_limits (struct cgraph_edge *e)
stack_size_limit = info->estimated_self_stack_size; stack_size_limit = info->estimated_self_stack_size;
if (to->global.inlined_to) if (to->global.inlined_to)
to = to->callers->caller; to = to->callers->caller;
else
break;
} }
while (to->global.inlined_to);
what_info = inline_summary (what); what_info = inline_summary (what);
...@@ -181,12 +182,15 @@ caller_growth_limits (struct cgraph_edge *e) ...@@ -181,12 +182,15 @@ caller_growth_limits (struct cgraph_edge *e)
return false; return false;
} }
if (!what_info->estimated_stack_size)
return true;
/* FIXME: Stack size limit often prevents inlining in Fortran programs /* FIXME: Stack size limit often prevents inlining in Fortran programs
due to large i/o datastructures used by the Fortran front-end. due to large i/o datastructures used by the Fortran front-end.
We ought to ignore this limit when we know that the edge is executed We ought to ignore this limit when we know that the edge is executed
on every invocation of the caller (i.e. its call statement dominates on every invocation of the caller (i.e. its call statement dominates
exit block). We do not track this information, yet. */ exit block). We do not track this information, yet. */
stack_size_limit += (stack_size_limit stack_size_limit += ((gcov_type)stack_size_limit
* PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) / 100); * PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) / 100);
inlined_stack = (outer_info->stack_frame_offset inlined_stack = (outer_info->stack_frame_offset
......
...@@ -141,6 +141,7 @@ extern VEC(edge_growth_cache_entry,heap) *edge_growth_cache; ...@@ -141,6 +141,7 @@ extern VEC(edge_growth_cache_entry,heap) *edge_growth_cache;
/* In ipa-inline-analysis.c */ /* In ipa-inline-analysis.c */
void debug_inline_summary (struct cgraph_node *); void debug_inline_summary (struct cgraph_node *);
void dump_inline_summaries (FILE *f); void dump_inline_summaries (FILE *f);
void dump_inline_summary (FILE * f, struct cgraph_node *node);
void inline_generate_summary (void); void inline_generate_summary (void);
void inline_read_summary (void); void inline_read_summary (void);
void inline_write_summary (cgraph_node_set, varpool_node_set); void inline_write_summary (cgraph_node_set, varpool_node_set);
......
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