On Sun, Sep 4, 2011 at 1:09 AM, Martin Jambor <mjam...@suse.cz> wrote: > Hi, > > we have agreed on this list recently that the versionable flag should > be moved from the inline summary to the local part of struct > cgraph_node because it has nothing to do with inlining and is computed > by ipa-prop and used only by ipa-cp. This patch does exactly that. > > Bootstrapped and tested on x86_64-linux. I have LTO-built Firefox > with it too. OK for trunk?
Ok. Thanks, Richard. > Thanks, > > Martin > > > 2011-09-03 Martin Jambor <mjam...@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. > > > Index: src/gcc/cgraph.h > =================================================================== > --- src.orig/gcc/cgraph.h > +++ src/gcc/cgraph.h > @@ -84,10 +84,13 @@ struct GTY(()) cgraph_local_info { > > /* Set when function is visible by other units. */ > unsigned externally_visible : 1; > - > + > /* Set once it has been finalized so we consider it to be output. */ > 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. > This is the case when __builtin_apply_args is used. */ > unsigned can_change_signature : 1; > Index: src/gcc/ipa-cp.c > =================================================================== > --- src.orig/gcc/ipa-cp.c > +++ src/gcc/ipa-cp.c > @@ -367,7 +367,7 @@ determine_versionability (struct cgraph_ > present. */ > if (node->alias || node->thunk.thunk_p) > reason = "alias or thunk"; > - else if (!inline_summary (node)->versionable) > + else if (!node->local.versionable) > reason = "not a tree_versionable_function"; > else if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE) > reason = "insufficient body availability"; > @@ -376,7 +376,7 @@ determine_versionability (struct cgraph_ > fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n", > 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 > @@ -385,7 +385,7 @@ determine_versionability (struct cgraph_ > static bool > 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. */ > @@ -2476,14 +2476,11 @@ ipcp_generate_summary (void) > fprintf (dump_file, "\nIPA constant propagation start:\n"); > 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) > { > /* Unreachable nodes should have been eliminated before ipcp. */ > gcc_assert (node->needed || node->reachable); > - > - inline_summary (node)->versionable = tree_versionable_function_p > (node->decl); > + node->local.versionable = tree_versionable_function_p (node->decl); > ipa_analyze_node (node); > } > } > Index: src/gcc/ipa-inline-analysis.c > =================================================================== > --- src.orig/gcc/ipa-inline-analysis.c > +++ src/gcc/ipa-inline-analysis.c > @@ -986,8 +986,6 @@ dump_inline_summary (FILE * f, struct cg > fprintf (f, " always_inline"); > if (s->inlinable) > fprintf (f, " inlinable"); > - if (s->versionable) > - fprintf (f, " versionable"); > fprintf (f, "\n self time: %i\n", > s->self_time); > fprintf (f, " global time: %i\n", s->time); > @@ -1642,7 +1640,7 @@ compute_inline_parameters (struct cgraph > struct inline_edge_summary *es = inline_edge_summary (node->callees); > struct predicate t = true_predicate (); > > - info->inlinable = info->versionable = 0; > + info->inlinable = 0; > node->callees->call_stmt_cannot_inline_p = true; > node->local.can_change_signature = false; > es->call_stmt_time = 1; > @@ -2408,7 +2406,6 @@ inline_read_section (struct lto_file_dec > > bp = streamer_read_bitpack (&ib); > info->inlinable = bp_unpack_value (&bp, 1); > - info->versionable = bp_unpack_value (&bp, 1); > > count2 = streamer_read_uhwi (&ib); > gcc_assert (!info->conds); > @@ -2539,7 +2536,6 @@ inline_write_summary (cgraph_node_set se > int i; > size_time_entry *e; > struct condition *c; > - > > streamer_write_uhwi (ob, lto_cgraph_encoder_encode (encoder, node)); > streamer_write_hwi (ob, info->estimated_self_stack_size); > @@ -2547,7 +2543,6 @@ inline_write_summary (cgraph_node_set se > streamer_write_hwi (ob, info->self_time); > bp = bitpack_create (ob->main_stream); > bp_pack_value (&bp, info->inlinable, 1); > - bp_pack_value (&bp, info->versionable, 1); > streamer_write_bitpack (&bp); > streamer_write_uhwi (ob, VEC_length (condition, info->conds)); > for (i = 0; VEC_iterate (condition, info->conds, i, c); i++) > Index: src/gcc/ipa-inline.h > =================================================================== > --- src.orig/gcc/ipa-inline.h > +++ src/gcc/ipa-inline.h > @@ -85,9 +85,6 @@ struct GTY(()) inline_summary > > /* False when there something makes inlining impossible (such as va_arg). > */ > 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 > inline decisions present in the callgraph. Generally kept up to > Index: src/gcc/lto-cgraph.c > =================================================================== > --- src.orig/gcc/lto-cgraph.c > +++ src/gcc/lto-cgraph.c > @@ -495,6 +495,7 @@ lto_output_node (struct lto_simple_outpu > bp_pack_value (&bp, node->local.local, 1); > bp_pack_value (&bp, node->local.externally_visible, 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.redefined_extern_inline, 1); > bp_pack_value (&bp, node->needed, 1); > @@ -896,6 +897,7 @@ input_overwrite_node (struct lto_file_de > node->local.local = bp_unpack_value (bp, 1); > node->local.externally_visible = 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.redefined_extern_inline = bp_unpack_value (bp, 1); > node->needed = bp_unpack_value (bp, 1); >