ipa-inline.h (struct inline_summary): Move versionable flag...

2011-09-06  Martin Jambor  <mjambor@suse.cz>

	* ipa-inline.h (struct inline_summary): Move versionable flag...
	* cgraph.h (struct cgraph_local_info): ...here
	* ipa-cp.c (determine_versionability): Use the new versionable flag.
	(determine_versionability): Likewise.
	(ipcp_versionable_function_p): Likewise.
	(ipcp_generate_summary): Likewise.
	* ipa-inline-analysis.c (dump_inline_summary): Do not dump the
	versionable flag.
	(compute_inline_parameters): Do not clear the versionable flag.
	(inline_read_section): Do not stream the versionable flag.
	(inline_write_summary): Likewise.
	* lto-cgraph.c (lto_output_node): Stream the versionable flag.
	(input_overwrite_node): Likewise.

From-SVN: r178598
This commit is contained in:
Martin Jambor 2011-09-06 16:46:55 +02:00 committed by Martin Jambor
parent 1a60c3521a
commit 124f1be6a9
6 changed files with 27 additions and 17 deletions

View File

@ -1,3 +1,19 @@
2011-09-06 Martin Jambor <mjambor@suse.cz>
* ipa-inline.h (struct inline_summary): Move versionable flag...
* cgraph.h (struct cgraph_local_info): ...here
* ipa-cp.c (determine_versionability): Use the new versionable flag.
(determine_versionability): Likewise.
(ipcp_versionable_function_p): Likewise.
(ipcp_generate_summary): Likewise.
* ipa-inline-analysis.c (dump_inline_summary): Do not dump the
versionable flag.
(compute_inline_parameters): Do not clear the versionable flag.
(inline_read_section): Do not stream the versionable flag.
(inline_write_summary): Likewise.
* lto-cgraph.c (lto_output_node): Stream the versionable flag.
(input_overwrite_node): Likewise.
2011-09-06 Richard Guenther <rguenther@suse.de> 2011-09-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48149 PR tree-optimization/48149

View File

@ -84,10 +84,13 @@ struct GTY(()) cgraph_local_info {
/* Set when function is visible by other units. */ /* Set when function is visible by other units. */
unsigned externally_visible : 1; unsigned externally_visible : 1;
/* Set once it has been finalized so we consider it to be output. */ /* Set once it has been finalized so we consider it to be output. */
unsigned finalized : 1; unsigned finalized : 1;
/* False when there is something makes versioning impossible. */
unsigned versionable : 1;
/* False when function calling convention and signature can not be changed. /* False when function calling convention and signature can not be changed.
This is the case when __builtin_apply_args is used. */ This is the case when __builtin_apply_args is used. */
unsigned can_change_signature : 1; unsigned can_change_signature : 1;

View File

@ -367,7 +367,7 @@ determine_versionability (struct cgraph_node *node)
present. */ present. */
if (node->alias || node->thunk.thunk_p) if (node->alias || node->thunk.thunk_p)
reason = "alias or thunk"; reason = "alias or thunk";
else if (!inline_summary (node)->versionable) else if (!node->local.versionable)
reason = "not a tree_versionable_function"; reason = "not a tree_versionable_function";
else if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE) else if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE)
reason = "insufficient body availability"; reason = "insufficient body availability";
@ -376,7 +376,7 @@ determine_versionability (struct cgraph_node *node)
fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n", fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n",
cgraph_node_name (node), node->uid, reason); cgraph_node_name (node), node->uid, reason);
inline_summary (node)->versionable = (reason == NULL); node->local.versionable = (reason == NULL);
} }
/* Return true if it is at all technically possible to create clones of a /* Return true if it is at all technically possible to create clones of a
@ -385,7 +385,7 @@ determine_versionability (struct cgraph_node *node)
static bool static bool
ipcp_versionable_function_p (struct cgraph_node *node) ipcp_versionable_function_p (struct cgraph_node *node)
{ {
return inline_summary (node)->versionable; return node->local.versionable;
} }
/* Structure holding accumulated information about callers of a node. */ /* Structure holding accumulated information about callers of a node. */
@ -2449,14 +2449,11 @@ ipcp_generate_summary (void)
fprintf (dump_file, "\nIPA constant propagation start:\n"); fprintf (dump_file, "\nIPA constant propagation start:\n");
ipa_register_cgraph_hooks (); ipa_register_cgraph_hooks ();
/* FIXME: We could propagate through thunks happily and we could be
even able to clone them, if needed. Do that later. */
FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
{ {
/* Unreachable nodes should have been eliminated before ipcp. */ /* Unreachable nodes should have been eliminated before ipcp. */
gcc_assert (node->needed || node->reachable); gcc_assert (node->needed || node->reachable);
node->local.versionable = tree_versionable_function_p (node->decl);
inline_summary (node)->versionable = tree_versionable_function_p (node->decl);
ipa_analyze_node (node); ipa_analyze_node (node);
} }
} }

View File

@ -986,8 +986,6 @@ dump_inline_summary (FILE * f, struct cgraph_node *node)
fprintf (f, " always_inline"); fprintf (f, " always_inline");
if (s->inlinable) if (s->inlinable)
fprintf (f, " inlinable"); fprintf (f, " inlinable");
if (s->versionable)
fprintf (f, " versionable");
fprintf (f, "\n self time: %i\n", fprintf (f, "\n self time: %i\n",
s->self_time); s->self_time);
fprintf (f, " global time: %i\n", s->time); fprintf (f, " global time: %i\n", s->time);
@ -1644,7 +1642,7 @@ compute_inline_parameters (struct cgraph_node *node, bool early)
struct inline_edge_summary *es = inline_edge_summary (node->callees); struct inline_edge_summary *es = inline_edge_summary (node->callees);
struct predicate t = true_predicate (); struct predicate t = true_predicate ();
info->inlinable = info->versionable = 0; info->inlinable = 0;
node->callees->call_stmt_cannot_inline_p = true; node->callees->call_stmt_cannot_inline_p = true;
node->local.can_change_signature = false; node->local.can_change_signature = false;
es->call_stmt_time = 1; es->call_stmt_time = 1;
@ -2410,7 +2408,6 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
bp = streamer_read_bitpack (&ib); bp = streamer_read_bitpack (&ib);
info->inlinable = bp_unpack_value (&bp, 1); info->inlinable = bp_unpack_value (&bp, 1);
info->versionable = bp_unpack_value (&bp, 1);
count2 = streamer_read_uhwi (&ib); count2 = streamer_read_uhwi (&ib);
gcc_assert (!info->conds); gcc_assert (!info->conds);
@ -2541,7 +2538,6 @@ inline_write_summary (cgraph_node_set set,
int i; int i;
size_time_entry *e; size_time_entry *e;
struct condition *c; struct condition *c;
streamer_write_uhwi (ob, lto_cgraph_encoder_encode (encoder, node)); streamer_write_uhwi (ob, lto_cgraph_encoder_encode (encoder, node));
streamer_write_hwi (ob, info->estimated_self_stack_size); streamer_write_hwi (ob, info->estimated_self_stack_size);
@ -2549,7 +2545,6 @@ inline_write_summary (cgraph_node_set set,
streamer_write_hwi (ob, info->self_time); streamer_write_hwi (ob, info->self_time);
bp = bitpack_create (ob->main_stream); bp = bitpack_create (ob->main_stream);
bp_pack_value (&bp, info->inlinable, 1); bp_pack_value (&bp, info->inlinable, 1);
bp_pack_value (&bp, info->versionable, 1);
streamer_write_bitpack (&bp); streamer_write_bitpack (&bp);
streamer_write_uhwi (ob, VEC_length (condition, info->conds)); streamer_write_uhwi (ob, VEC_length (condition, info->conds));
for (i = 0; VEC_iterate (condition, info->conds, i, c); i++) for (i = 0; VEC_iterate (condition, info->conds, i, c); i++)

View File

@ -85,9 +85,6 @@ struct GTY(()) inline_summary
/* False when there something makes inlining impossible (such as va_arg). */ /* False when there something makes inlining impossible (such as va_arg). */
unsigned inlinable : 1; unsigned inlinable : 1;
/* False when there something makes versioning impossible.
Currently computed and used only by ipa-cp. */
unsigned versionable : 1;
/* Information about function that will result after applying all the /* Information about function that will result after applying all the
inline decisions present in the callgraph. Generally kept up to inline decisions present in the callgraph. Generally kept up to

View File

@ -495,6 +495,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
bp_pack_value (&bp, node->local.local, 1); bp_pack_value (&bp, node->local.local, 1);
bp_pack_value (&bp, node->local.externally_visible, 1); bp_pack_value (&bp, node->local.externally_visible, 1);
bp_pack_value (&bp, node->local.finalized, 1); bp_pack_value (&bp, node->local.finalized, 1);
bp_pack_value (&bp, node->local.versionable, 1);
bp_pack_value (&bp, node->local.can_change_signature, 1); bp_pack_value (&bp, node->local.can_change_signature, 1);
bp_pack_value (&bp, node->local.redefined_extern_inline, 1); bp_pack_value (&bp, node->local.redefined_extern_inline, 1);
bp_pack_value (&bp, node->needed, 1); bp_pack_value (&bp, node->needed, 1);
@ -896,6 +897,7 @@ input_overwrite_node (struct lto_file_decl_data *file_data,
node->local.local = bp_unpack_value (bp, 1); node->local.local = bp_unpack_value (bp, 1);
node->local.externally_visible = bp_unpack_value (bp, 1); node->local.externally_visible = bp_unpack_value (bp, 1);
node->local.finalized = bp_unpack_value (bp, 1); node->local.finalized = bp_unpack_value (bp, 1);
node->local.versionable = bp_unpack_value (bp, 1);
node->local.can_change_signature = bp_unpack_value (bp, 1); node->local.can_change_signature = bp_unpack_value (bp, 1);
node->local.redefined_extern_inline = bp_unpack_value (bp, 1); node->local.redefined_extern_inline = bp_unpack_value (bp, 1);
node->needed = bp_unpack_value (bp, 1); node->needed = bp_unpack_value (bp, 1);