public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Guenther <rguenther@suse.de>
Cc: Jan Hubicka <hubicka@ucw.cz>, gcc-patches@gcc.gnu.org, mjambor@suse.cz
Subject: Re: Cgraph thunk reorg
Date: Fri, 06 May 2011 17:05:00 -0000	[thread overview]
Message-ID: <20110506165605.GE3424@kam.mff.cuni.cz> (raw)
In-Reply-To: <alpine.LNX.2.00.1105061434040.810@zhemvz.fhfr.qr>

Forgot to reply this one...
> > *************** assemble_thunk (struct cgraph_node *node
> > *** 1406,1411 ****
> > --- 1427,1433 ----
> >         free_after_compilation (cfun);
> >         set_cfun (NULL);
> >         TREE_ASM_WRITTEN (thunk_fndecl) = 1;
> > +       node->thunk.thunk_p = false;
> 
> Hmm.  Doesn't that confuse regular passes who now see the thunk no
> longer as thunk?

... this happens only at expansion times. No other regular passes are run, so
it is safe.  Clearing thunk_p flag has several resons: it makes
add_new_function happy, it prevents verifier from complaining on thunk with
gimple body and it prevents assemble_thunks to output thunk several times.

Incrementally perhaps I can allow thunks to optionally have gimple bodies. This
would be handy also for inliner who consequently would be able to handle them
as normal function as it don't really care about variadic thunks (unlike
ipa-prop).  This is just minor loss of code quality as we inline only variadic
functions that never start va_start. I.e. they either ignore the variadic arugments
or use va_arg_pack.  I can imagine people doing the first for virtual functions,
the second don't really make sense as va_arg_pack should be used only in always_inlines
and those can not be virtual.

negative side of doing so is that, I am affraid that IPA passes will start
modify these bodies in free manner and boil down the ASM output path.  So
perhaps it is easier to explain inliner explicietly what "inlining thunk" means
that will also allow us to handle variadic ones and stick on current way.

Something I want to handle incrementally: obviously solution exists, just we want one
that is not too ugly. At the moment inlning of thunks is moot given that we have
only one testcase that produce direct call to a thunk.  Hopefully we will noticeably
improve in devirtualization and this will become all much more fun.

Honza
> 
> >       }
> >     else
> >       {
> > *************** assemble_thunk (struct cgraph_node *node
> > *** 1530,1544 ****
> >         delete_unreachable_blocks ();
> >         update_ssa (TODO_update_ssa);
> >   
> > -       cgraph_remove_same_body_alias (node);
> >         /* Since we want to emit the thunk, we explicitly mark its name as
> >   	 referenced.  */
> >         cgraph_add_new_function (thunk_fndecl, true);
> >         bitmap_obstack_release (NULL);
> >       }
> >     current_function_decl = NULL;
> >   }
> >   
> >   /* Expand function specified by NODE.  */
> >   
> >   static void
> > --- 1552,1587 ----
> >         delete_unreachable_blocks ();
> >         update_ssa (TODO_update_ssa);
> >   
> >         /* Since we want to emit the thunk, we explicitly mark its name as
> >   	 referenced.  */
> > +       node->thunk.thunk_p = false;
> > +       cgraph_node_remove_callees (node);
> >         cgraph_add_new_function (thunk_fndecl, true);
> >         bitmap_obstack_release (NULL);
> >       }
> >     current_function_decl = NULL;
> >   }
> >   
> > + 
> > + /* Assemble thunks asociated to NODE.  */
> > + 
> > + static void
> > + assemble_thunks (struct cgraph_node *node)
> > + {
> > +   struct cgraph_edge *e;
> > +   for (e = node->callers; e;)
> > +     if (e->caller->thunk.thunk_p)
> > +       {
> > + 	struct cgraph_node *thunk = e->caller;
> > + 
> > + 	e = e->next_caller;
> > + 	assemble_thunks (thunk);
> > +         assemble_thunk (thunk);
> > +       }
> > +     else
> > +       e = e->next_caller;
> > + }
> > + 
> >   /* Expand function specified by NODE.  */
> >   
> >   static void
> > *************** cgraph_expand_function (struct cgraph_no
> > *** 1566,1578 ****
> >   	  if (!alias->thunk.thunk_p)
> >   	    assemble_alias (alias->decl,
> >   			    DECL_ASSEMBLER_NAME (alias->thunk.alias));
> > - 	  else
> > - 	    assemble_thunk (alias);
> >   	}
> >         node->alias = saved_alias;
> >         cgraph_process_new_functions ();
> >       }
> >   
> >     gcc_assert (node->lowered);
> >   
> >     /* Generate RTL for the body of DECL.  */
> > --- 1609,1620 ----
> >   	  if (!alias->thunk.thunk_p)
> >   	    assemble_alias (alias->decl,
> >   			    DECL_ASSEMBLER_NAME (alias->thunk.alias));
> >   	}
> >         node->alias = saved_alias;
> >         cgraph_process_new_functions ();
> >       }
> >   
> > +   assemble_thunks (node);
> >     gcc_assert (node->lowered);
> >   
> >     /* Generate RTL for the body of DECL.  */
> > *************** cgraph_output_in_order (void)
> > *** 1688,1694 ****
> >   
> >     for (pf = cgraph_nodes; pf; pf = pf->next)
> >       {
> > !       if (pf->process)
> >   	{
> >   	  i = pf->order;
> >   	  gcc_assert (nodes[i].kind == ORDER_UNDEFINED);
> > --- 1730,1736 ----
> >   
> >     for (pf = cgraph_nodes; pf; pf = pf->next)
> >       {
> > !       if (pf->process && !pf->thunk.thunk_p)
> >   	{
> >   	  i = pf->order;
> >   	  gcc_assert (nodes[i].kind == ORDER_UNDEFINED);
> > Index: lto-cgraph.c
> > ===================================================================
> > *** lto-cgraph.c	(revision 173251)
> > --- lto-cgraph.c	(working copy)
> > *************** lto_output_node (struct lto_simple_outpu
> > *** 502,510 ****
> > --- 502,525 ----
> >     bp_pack_value (&bp, node->frequency, 2);
> >     bp_pack_value (&bp, node->only_called_at_startup, 1);
> >     bp_pack_value (&bp, node->only_called_at_exit, 1);
> > +   bp_pack_value (&bp, node->thunk.thunk_p, 1);
> >     lto_output_bitpack (&bp);
> >     lto_output_uleb128_stream (ob->main_stream, node->resolution);
> >   
> > +   if (node->thunk.thunk_p)
> > +     {
> > +       lto_output_uleb128_stream
> > + 	 (ob->main_stream,
> > + 	  1 + (node->thunk.this_adjusting != 0) * 2
> > + 	  + (node->thunk.virtual_offset_p != 0) * 4);
> > +       lto_output_uleb128_stream (ob->main_stream,
> > + 				 node->thunk.fixed_offset);
> > +       lto_output_uleb128_stream (ob->main_stream,
> > + 				 node->thunk.virtual_value);
> > +       lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
> > + 				node->thunk.alias);
> > +     }
> > + 
> >     if (node->same_body)
> >       {
> >         struct cgraph_node *alias;
> > *************** lto_output_node (struct lto_simple_outpu
> > *** 516,540 ****
> >   	{
> >   	  lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
> >   				    alias->decl);
> > ! 	  if (alias->thunk.thunk_p)
> > ! 	    {
> > !               lto_output_uleb128_stream
> > ! 	         (ob->main_stream,
> > ! 	      	  1 + (alias->thunk.this_adjusting != 0) * 2
> > ! 		  + (alias->thunk.virtual_offset_p != 0) * 4);
> > ! 	      lto_output_uleb128_stream (ob->main_stream,
> > ! 	      				 alias->thunk.fixed_offset);
> > ! 	      lto_output_uleb128_stream (ob->main_stream,
> > ! 	      				 alias->thunk.virtual_value);
> > ! 	      lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
> > ! 					alias->thunk.alias);
> > ! 	    }
> > ! 	  else
> > ! 	    {
> > ! 	      lto_output_uleb128_stream (ob->main_stream, 0);
> > ! 	      lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
> > ! 					alias->thunk.alias);
> > ! 	    }
> >   	  gcc_assert (cgraph_get_node (alias->thunk.alias) == node);
> >   	  lto_output_uleb128_stream (ob->main_stream, alias->resolution);
> >   	  alias = alias->previous;
> > --- 531,538 ----
> >   	{
> >   	  lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
> >   				    alias->decl);
> > ! 	  lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
> > ! 				    alias->thunk.alias);
> >   	  gcc_assert (cgraph_get_node (alias->thunk.alias) == node);
> >   	  lto_output_uleb128_stream (ob->main_stream, alias->resolution);
> >   	  alias = alias->previous;
> > *************** input_overwrite_node (struct lto_file_de
> > *** 947,952 ****
> > --- 945,951 ----
> >     node->frequency = (enum node_frequency)bp_unpack_value (bp, 2);
> >     node->only_called_at_startup = bp_unpack_value (bp, 1);
> >     node->only_called_at_exit = bp_unpack_value (bp, 1);
> > +   node->thunk.thunk_p = bp_unpack_value (bp, 1);
> >     node->resolution = resolution;
> >   }
> >   
> > *************** input_node (struct lto_file_decl_data *f
> > *** 1031,1064 ****
> >     /* Store a reference for now, and fix up later to be a pointer.  */
> >     node->same_comdat_group = (cgraph_node_ptr) (intptr_t) ref2;
> >   
> >     same_body_count = lto_input_uleb128 (ib);
> >     while (same_body_count-- > 0)
> >       {
> > !       tree alias_decl;
> > !       int type;
> >         struct cgraph_node *alias;
> >         decl_index = lto_input_uleb128 (ib);
> >         alias_decl = lto_file_decl_data_get_fn_decl (file_data, decl_index);
> > !       type = lto_input_uleb128 (ib);
> > !       if (!type)
> > ! 	{
> > ! 	  tree real_alias;
> > ! 	  decl_index = lto_input_uleb128 (ib);
> > ! 	  real_alias = lto_file_decl_data_get_fn_decl (file_data, decl_index);
> > ! 	  alias = cgraph_same_body_alias (node, alias_decl, real_alias);
> > ! 	}
> > !       else
> > !         {
> > ! 	  HOST_WIDE_INT fixed_offset = lto_input_uleb128 (ib);
> > ! 	  HOST_WIDE_INT virtual_value = lto_input_uleb128 (ib);
> > ! 	  tree real_alias;
> > ! 	  decl_index = lto_input_uleb128 (ib);
> > ! 	  real_alias = lto_file_decl_data_get_fn_decl (file_data, decl_index);
> > ! 	  alias = cgraph_add_thunk (node, alias_decl, fn_decl, type & 2, fixed_offset,
> > ! 				    virtual_value,
> > ! 				    (type & 4) ? size_int (virtual_value) : NULL_TREE,
> > ! 				    real_alias);
> > ! 	}
> >         gcc_assert (alias);
> >         alias->resolution = (enum ld_plugin_symbol_resolution)lto_input_uleb128 (ib);
> >       }
> > --- 1030,1062 ----
> >     /* Store a reference for now, and fix up later to be a pointer.  */
> >     node->same_comdat_group = (cgraph_node_ptr) (intptr_t) ref2;
> >   
> > +   if (node->thunk.thunk_p)
> > +     {
> > +       int type = lto_input_uleb128 (ib);
> > +       HOST_WIDE_INT fixed_offset = lto_input_uleb128 (ib);
> > +       HOST_WIDE_INT virtual_value = lto_input_uleb128 (ib);
> > +       tree real_alias;
> > + 
> > +       decl_index = lto_input_uleb128 (ib);
> > +       real_alias = lto_file_decl_data_get_fn_decl (file_data, decl_index);
> > +       node->thunk.fixed_offset = fixed_offset;
> > +       node->thunk.this_adjusting = (type & 2);
> > +       node->thunk.virtual_value = virtual_value;
> > +       node->thunk.virtual_offset_p = (type & 4);
> > +       node->thunk.alias = real_alias;
> > +     }
> > + 
> >     same_body_count = lto_input_uleb128 (ib);
> >     while (same_body_count-- > 0)
> >       {
> > !       tree alias_decl, real_alias;
> >         struct cgraph_node *alias;
> > + 
> >         decl_index = lto_input_uleb128 (ib);
> >         alias_decl = lto_file_decl_data_get_fn_decl (file_data, decl_index);
> > !       decl_index = lto_input_uleb128 (ib);
> > !       real_alias = lto_file_decl_data_get_fn_decl (file_data, decl_index);
> > !       alias = cgraph_same_body_alias (node, alias_decl, real_alias);
> >         gcc_assert (alias);
> >         alias->resolution = (enum ld_plugin_symbol_resolution)lto_input_uleb128 (ib);
> >       }
> > Index: ipa-pure-const.c
> > ===================================================================
> > *** ipa-pure-const.c	(revision 173251)
> > --- ipa-pure-const.c	(working copy)
> > *************** analyze_function (struct cgraph_node *fn
> > *** 731,736 ****
> > --- 731,746 ----
> >     l->looping_previously_known = true;
> >     l->looping = false;
> >     l->can_throw = false;
> > +   state_from_flags (&l->state_previously_known, &l->looping_previously_known,
> > + 		    flags_from_decl_or_type (fn->decl),
> > + 		    cgraph_node_cannot_return (fn));
> > + 
> > +   if (fn->thunk.thunk_p)
> > +     {
> > +       /* Thunk gets propagated through, so nothing interesting happens.  */
> > +       gcc_assert (ipa);
> > +       return l;
> > +     }
> >   
> >     if (dump_file)
> >       {
> > *************** end:
> > *** 799,807 ****
> >   
> >     if (dump_file && (dump_flags & TDF_DETAILS))
> >       fprintf (dump_file, "    checking previously known:");
> > -   state_from_flags (&l->state_previously_known, &l->looping_previously_known,
> > - 		    flags_from_decl_or_type (fn->decl),
> > - 		    cgraph_node_cannot_return (fn));
> >   
> >     better_state (&l->pure_const_state, &l->looping,
> >   		l->state_previously_known,
> > --- 809,814 ----
> > Index: lto-streamer-out.c
> > ===================================================================
> > *** lto-streamer-out.c	(revision 173251)
> > --- lto-streamer-out.c	(working copy)
> > *************** lto_output (cgraph_node_set set, varpool
> > *** 2197,2203 ****
> >     for (i = 0; i < n_nodes; i++)
> >       {
> >         node = lto_cgraph_encoder_deref (encoder, i);
> > !       if (lto_cgraph_encoder_encode_body_p (encoder, node))
> >   	{
> >   #ifdef ENABLE_CHECKING
> >   	  gcc_assert (!bitmap_bit_p (output, DECL_UID (node->decl)));
> > --- 2197,2204 ----
> >     for (i = 0; i < n_nodes; i++)
> >       {
> >         node = lto_cgraph_encoder_deref (encoder, i);
> > !       if (lto_cgraph_encoder_encode_body_p (encoder, node)
> > ! 	  && !node->thunk.thunk_p)
> >   	{
> >   #ifdef ENABLE_CHECKING
> >   	  gcc_assert (!bitmap_bit_p (output, DECL_UID (node->decl)));
> > Index: ipa-inline.c
> > ===================================================================
> > *** ipa-inline.c	(revision 173251)
> > --- ipa-inline.c	(working copy)
> > *************** inline_small_functions (void)
> > *** 1177,1185 ****
> >     max_count = 0;
> >     initialize_growth_caches ();
> >   
> > !   for (node = cgraph_nodes; node; node = node->next)
> > !     if (node->analyzed
> > ! 	&& !node->global.inlined_to)
> >         {
> >   	struct inline_summary *info = inline_summary (node);
> >   
> > --- 1177,1184 ----
> >     max_count = 0;
> >     initialize_growth_caches ();
> >   
> > !   FOR_EACH_DEFINED_FUNCTION (node)
> > !     if (!node->global.inlined_to)
> >         {
> >   	struct inline_summary *info = inline_summary (node);
> >   
> > *************** inline_small_functions (void)
> > *** 1197,1205 ****
> >   
> >     /* Populate the heeap with all edges we might inline.  */
> >   
> > !   for (node = cgraph_nodes; node; node = node->next)
> > !     if (node->analyzed
> > ! 	&& !node->global.inlined_to)
> >         {
> >   	if (dump_file)
> >   	  fprintf (dump_file, "Enqueueing calls of %s/%i.\n",
> > --- 1196,1203 ----
> >   
> >     /* Populate the heeap with all edges we might inline.  */
> >   
> > !   FOR_EACH_DEFINED_FUNCTION (node)
> > !     if (!node->global.inlined_to)
> >         {
> >   	if (dump_file)
> >   	  fprintf (dump_file, "Enqueueing calls of %s/%i.\n",
> > Index: ipa.c
> > ===================================================================
> > *** ipa.c	(revision 173251)
> > --- ipa.c	(working copy)
> > *************** function_and_variable_visibility (bool w
> > *** 877,883 ****
> > --- 877,922 ----
> >   	       segfault though. */
> >   	    dissolve_same_comdat_group_list (node);
> >   	}
> > +       if (node->thunk.thunk_p)
> > + 	{
> > + 	  struct cgraph_node *decl_node = node;
> > + 
> > + 	  while (decl_node->thunk.thunk_p)
> > + 	    decl_node = decl_node->callees->callee;
> > + 
> > + 	  /* Thunks have the same visibility as function they are attached to.
> > + 	     For some reason C++ frontend don't seem to care. I.e. in 
> > + 	     g++.dg/torture/pr41257-2.C the thunk is not comdat while function
> > + 	     it is attached to is.
> > + 
> > + 	     We also need to arrange the thunk into the same comdat group as
> > + 	     the function it reffers to.  */
> > + 	  if (DECL_COMDAT (decl_node->decl))
> > + 	    {
> > + 	      DECL_COMDAT (node->decl) = 1;
> > + 	      DECL_COMDAT_GROUP (node->decl) = DECL_COMDAT_GROUP (decl_node->decl);
> > + 	      if (!node->same_comdat_group)
> > + 		{
> > + 
> > + 		  node->same_comdat_group = decl_node;
> > + 		  if (!decl_node->same_comdat_group)
> > + 		    decl_node->same_comdat_group = node;
> > + 		  else
> > + 		    {
> > + 		      struct cgraph_node *n;
> > + 		      for (n = decl_node->same_comdat_group;
> > + 			   n->same_comdat_group != decl_node;
> > + 			   n = n->same_comdat_group)
> > + 			;
> > + 		      n->same_comdat_group = decl_node;
> > + 		    }
> > + 		}
> > + 	    }
> > + 	  if (DECL_EXTERNAL (decl_node->decl))
> > + 	    DECL_EXTERNAL (node->decl) = 1;
> 
> That's indeed remarkably ugly and I hope the C++ FE people can do
> sth about this ...
> 
> > + 	}
> >         node->local.local = cgraph_local_node_p (node);
> > + 
> >       }
> >     for (vnode = varpool_nodes; vnode; vnode = vnode->next)
> >       {
> > Index: ipa-inline-analysis.c
> > ===================================================================
> > *** ipa-inline-analysis.c	(revision 173251)
> > --- ipa-inline-analysis.c	(working copy)
> > *************** compute_inline_parameters (struct cgraph
> > *** 1443,1448 ****
> > --- 1443,1465 ----
> >   
> >     info = inline_summary (node);
> >   
> > +   /* FIXME: Thunks are inlinable, but tree-inline don't know how to do that.
> > +      Once this happen, we will need to more curefully predict call
> 
> carefully
> 
> > +      statement size.  */
> > +   if (node->thunk.thunk_p)
> > +     {
> > +       struct inline_edge_summary *es = inline_edge_summary (node->callees);
> > +       struct predicate t = true_predicate ();
> > + 
> > +       info->inlinable = info->versionable = 0;
> > +       node->callees->call_stmt_cannot_inline_p = true;
> > +       node->local.can_change_signature = false;
> > +       es->call_stmt_time = 1;
> > +       es->call_stmt_size = 1;
> > +       account_size_time (info, 0, 0, &t);
> > +       return;
> > +     }
> > + 
> >     /* Estimate the stack size for the function if we're optimizing.  */
> >     self_stack_size = optimize ? estimated_stack_frame_size (node) : 0;
> >     info->estimated_self_stack_size = self_stack_size;
> > *************** inline_analyze_function (struct cgraph_n
> > *** 2027,2033 ****
> >   	     cgraph_node_name (node), node->uid);
> >     /* FIXME: We should remove the optimize check after we ensure we never run
> >        IPA passes when not optimizing.  */
> > !   if (flag_indirect_inlining && optimize)
> >       inline_indirect_intraprocedural_analysis (node);
> >     compute_inline_parameters (node, false);
> >   
> > --- 2044,2050 ----
> >   	     cgraph_node_name (node), node->uid);
> >     /* FIXME: We should remove the optimize check after we ensure we never run
> >        IPA passes when not optimizing.  */
> > !   if (flag_indirect_inlining && optimize && !node->thunk.thunk_p)
> >       inline_indirect_intraprocedural_analysis (node);
> >     compute_inline_parameters (node, false);
> >   
> > *************** inline_generate_summary (void)
> > *** 2058,2065 ****
> >     if (flag_indirect_inlining)
> >       ipa_register_cgraph_hooks ();
> >   
> > !   for (node = cgraph_nodes; node; node = node->next)
> > !     if (node->analyzed)
> >         inline_analyze_function (node);
> >   }
> >   
> > --- 2075,2081 ----
> >     if (flag_indirect_inlining)
> >       ipa_register_cgraph_hooks ();
> >   
> > !   FOR_EACH_DEFINED_FUNCTION (node)
> >         inline_analyze_function (node);
> >   }
> >   
> > Index: lto/lto.c
> > ===================================================================
> > *** lto/lto.c	(revision 173251)
> > --- lto/lto.c	(working copy)
> > *************** lto_materialize_function (struct cgraph_
> > *** 147,155 ****
> >     decl = node->decl;
> >     /* Read in functions with body (analyzed nodes)
> >        and also functions that are needed to produce virtual clones.  */
> > !   if (node->analyzed || has_analyzed_clone_p (node))
> >       {
> > !       /* Clones don't need to be read.  */
> >         if (node->clone_of)
> >   	return;
> >   
> > --- 147,155 ----
> >     decl = node->decl;
> >     /* Read in functions with body (analyzed nodes)
> >        and also functions that are needed to produce virtual clones.  */
> > !   if (cgraph_function_with_gimple_body_p (node) || has_analyzed_clone_p (node))
> >       {
> > !       /* Clones and thunks don't need to be read.  */
> >         if (node->clone_of)
> >   	return;
> >   
> > *************** static void
> > *** 1183,1188 ****
> > --- 1183,1194 ----
> >   add_cgraph_node_to_partition (ltrans_partition part, struct cgraph_node *node)
> >   {
> >     struct cgraph_edge *e;
> > +   cgraph_node_set_iterator csi;
> > + 
> > +   /* If NODE is already there, we have nothing to do.  */
> > +   csi = cgraph_node_set_find (part->cgraph_set, node);
> > +   if (!csi_end_p (csi))
> > +     return;
> >   
> >     part->insns += inline_summary (node)->self_size;
> >   
> > *************** add_cgraph_node_to_partition (ltrans_par
> > *** 1197,1202 ****
> > --- 1203,1215 ----
> >   
> >     cgraph_node_set_add (part->cgraph_set, node);
> >   
> > +   /* Thunks always must go along with function they reffer to.  */
> > +   if (node->thunk.thunk_p)
> > +     add_cgraph_node_to_partition (part, node->callees->callee);
> > +   for (e = node->callers; e; e = e->next_caller)
> > +     if (e->caller->thunk.thunk_p)
> > +       add_cgraph_node_to_partition (part, e->caller);
> > + 
> >     for (e = node->callees; e; e = e->next_callee)
> >       if ((!e->inline_failed || DECL_COMDAT (e->callee->decl))
> >   	&& !cgraph_node_in_set_p (e->callee, part->cgraph_set))
> > *************** add_cgraph_node_to_partition (ltrans_par
> > *** 1214,1219 ****
> > --- 1227,1239 ----
> >   static void
> >   add_varpool_node_to_partition (ltrans_partition part, struct varpool_node *vnode)
> >   {
> > +   varpool_node_set_iterator vsi;
> > + 
> > +   /* If NODE is already there, we have nothing to do.  */
> > +   vsi = varpool_node_set_find (part->varpool_set, vnode);
> > +   if (!vsi_end_p (vsi))
> > +     return;
> > + 
> >     varpool_node_set_add (part->varpool_set, vnode);
> >   
> >     if (vnode->aux)
> > Index: ipa-prop.c
> > ===================================================================
> > *** ipa-prop.c	(revision 173251)
> > --- ipa-prop.c	(working copy)
> > *************** ipa_prop_write_jump_functions (cgraph_no
> > *** 2898,2904 ****
> >     for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
> >       {
> >         node = csi_node (csi);
> > !       if (node->analyzed && IPA_NODE_REF (node) != NULL)
> >           ipa_write_node_info (ob, node);
> >       }
> >     lto_output_1_stream (ob->main_stream, 0);
> > --- 2898,2905 ----
> >     for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
> >       {
> >         node = csi_node (csi);
> > !       if (cgraph_function_with_gimple_body_p (node)
> > ! 	  && IPA_NODE_REF (node) != NULL)
> >           ipa_write_node_info (ob, node);
> >       }
> >     lto_output_1_stream (ob->main_stream, 0);
> > Index: passes.c
> > ===================================================================
> > *** passes.c	(revision 173251)
> > --- passes.c	(working copy)
> > *************** do_per_function_toporder (void (*callbac
> > *** 1135,1141 ****
> >   	  /* Allow possibly removed nodes to be garbage collected.  */
> >   	  order[i] = NULL;
> >   	  node->process = 0;
> > ! 	  if (node->analyzed)
> >   	    {
> >   	      push_cfun (DECL_STRUCT_FUNCTION (node->decl));
> >   	      current_function_decl = node->decl;
> > --- 1135,1141 ----
> >   	  /* Allow possibly removed nodes to be garbage collected.  */
> >   	  order[i] = NULL;
> >   	  node->process = 0;
> > ! 	  if (cgraph_function_with_gimple_body_p (node))
> >   	    {
> >   	      push_cfun (DECL_STRUCT_FUNCTION (node->decl));
> >   	      current_function_decl = node->decl;
> > *************** execute_one_pass (struct opt_pass *pass)
> > *** 1581,1590 ****
> >     if (pass->type == IPA_PASS)
> >       {
> >         struct cgraph_node *node;
> > !       for (node = cgraph_nodes; node; node = node->next)
> > !         if (node->analyzed)
> > !           VEC_safe_push (ipa_opt_pass, heap, node->ipa_transforms_to_apply,
> > ! 			 (struct ipa_opt_pass_d *)pass);
> >       }
> >   
> >     if (!current_function_decl)
> > --- 1581,1589 ----
> >     if (pass->type == IPA_PASS)
> >       {
> >         struct cgraph_node *node;
> > !       FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
> > ! 	VEC_safe_push (ipa_opt_pass, heap, node->ipa_transforms_to_apply,
> > ! 		       (struct ipa_opt_pass_d *)pass);
> >       }
> >   
> >     if (!current_function_decl)
> > *************** ipa_write_summaries (void)
> > *** 1705,1711 ****
> >       {
> >         struct cgraph_node *node = order[i];
> >   
> > !       if (node->analyzed)
> >   	{
> >   	  /* When streaming out references to statements as part of some IPA
> >   	     pass summary, the statements need to have uids assigned and the
> > --- 1704,1710 ----
> >       {
> >         struct cgraph_node *node = order[i];
> >   
> > !       if (cgraph_function_with_gimple_body_p (node))
> >   	{
> >   	  /* When streaming out references to statements as part of some IPA
> >   	     pass summary, the statements need to have uids assigned and the
> > *************** ipa_write_summaries (void)
> > *** 1718,1724 ****
> >   	  pop_cfun ();
> >   	}
> >         if (node->analyzed)
> > ! 	cgraph_node_set_add (set, node);
> >       }
> >     vset = varpool_node_set_new ();
> >   
> > --- 1717,1723 ----
> >   	  pop_cfun ();
> >   	}
> >         if (node->analyzed)
> > !         cgraph_node_set_add (set, node);
> >       }
> >     vset = varpool_node_set_new ();
> >   
> > *************** function_called_by_processed_nodes_p (vo
> > *** 2036,2042 ****
> >       {
> >         if (e->caller->decl == current_function_decl)
> >           continue;
> > !       if (!e->caller->analyzed)
> >           continue;
> >         if (TREE_ASM_WRITTEN (e->caller->decl))
> >           continue;
> > --- 2035,2041 ----
> >       {
> >         if (e->caller->decl == current_function_decl)
> >           continue;
> > !       if (!cgraph_function_with_gimple_body_p (e->caller))
> >           continue;
> >         if (TREE_ASM_WRITTEN (e->caller->decl))
> >           continue;
> 
> I think the rest looks reasonable.
> 
> Thanks,
> Richard.

  parent reply	other threads:[~2011-05-06 16:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06 12:34 Jan Hubicka
2011-05-06 13:00 ` Richard Guenther
2011-05-06 16:56   ` Jan Hubicka
2011-05-06 17:05   ` Jan Hubicka [this message]
2011-05-06 23:31   ` Jan Hubicka
2011-05-15 22:19     ` H.J. Lu
2011-05-06 15:08 ` Michael Matz
2011-05-06 16:05 ` Mike Stump
2011-05-10 21:48 David Edelsohn
2011-05-11 13:42 ` Jan Hubicka
2011-05-13 14:02 ` Jan Hubicka
     [not found] ` <20110513144959.GR32522@kam.mff.cuni.cz>
     [not found]   ` <BANLkTi=SYNwzNK4mpM9H4cEf4xcssfi4gQ@mail.gmail.com>
2011-05-25 14:55     ` David Edelsohn
2011-05-25 23:49       ` Jan Hubicka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110506165605.GE3424@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mjambor@suse.cz \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).