This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [CFT, try 9] Emulated tls rewrite


On Wed, Jul 21, 2010 at 12:38:30PM -0700, Richard Henderson wrote:
> On 07/21/2010 09:32 AM, Richard Henderson wrote:
> > On 07/21/2010 01:23 AM, Richard Guenther wrote:
> >> Couldn't you do gsi_insert_on_edge_immediate?
> > 
> > I could.  It doesn't really help though, since the location at which
> > the call statement and the call edge are created is shared between
> > the normal statements and the phi statements.  It gets ugly either way.
> 
> As discussed on IRC, what do you think of this incremental patch?
> 
> I've tested it on tls.exp and see no failures.  I'll start a proper
> bootstrap and test in a moment to see that there are no other 
> unexpected consequences.

> --- a/gcc/gimple-iterator.c
> +++ b/gcc/gimple-iterator.c
> @@ -65,6 +65,25 @@ update_bb_for_stmts (gimple_seq_node first, basic_block bb)
>      gimple_set_bb (n->stmt, bb);
>  }
>  
> +/* Set the frequencies for the cgraph_edges for each of the calls
> +   starting at FIRST for their new position within BB.  */
> +
> +static void
> +update_call_edge_frequencies (gimple_seq_node first, basic_block bb)
> +{
> +  int bb_freq = compute_call_stmt_bb_frequency (current_function_decl, bb);
> +  struct cgraph_node *cfun_node = cgraph_node (current_function_decl);

Aren't the above two calls expensive enough that it would be better to
only call them after seeing first is_gimple_call?
Many bbs don't contain any calls...

> +  gimple_seq_node n;
> +
> +  for (n = first; n ; n = n->next)
> +    if (is_gimple_call (n->stmt))
> +      {
> +	struct cgraph_edge *e = cgraph_edge (cfun_node, n->stmt);
> +	if (e != NULL)
> +	  e->frequency = bb_freq;
> +      }
> +}
> +

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]