[google] Dump inline decisions more wisely

Xinliang David Li davidxl@google.com
Thu Jan 5 17:46:00 GMT 2012


Is there a better way to detect early inline phase and ipa_inline
pass? Use always_inline_functions_inlined flag seems hacky.

David

On Wed, Jan 4, 2012 at 1:12 AM, Dehao Chen <dehao@google.com> wrote:
> Hi,
>
> This patch:
>
> * dump inline decisions with profile info whenever available.
> * disable dump of einline decisions at OPT_INFO_MIN.
>
> Is it ok for google branches?
>
> thanks,
> Dehao
>
> 2012-01-04  Dehao Chen  <dehao@google.com>
>
>        * ipa-inline.c (cgraph_node_opt_info): Print profile info if available
>        (dump_inline_decision): Disable einline dump at OPT_INFO_MIN
>
> Index: gcc/ipa-inline.c
> ===================================================================
> --- gcc/ipa-inline.c    (revision 182864)
> +++ gcc/ipa-inline.c    (working copy)
> @@ -308,12 +308,12 @@
>     bfd_name = "unknown";
>
>   buf_size = strlen (bfd_name) + 1;
> -  if (flag_opt_info >= OPT_INFO_MED && profile_info)
> +  if (profile_info)
>     buf_size += (2 * MAX_INT_LENGTH + 5);
>   buf = (char *) xmalloc (buf_size);
>
>   strcpy (buf, bfd_name);
> -  if (flag_opt_info >= OPT_INFO_MED && profile_info)
> +  if (profile_info)
>     sprintf (buf,
>             "%s ("HOST_WIDEST_INT_PRINT_DEC", "HOST_WIDEST_INT_PRINT_DEC")",
>             buf, node->count, node->max_bb_count);
> @@ -364,6 +364,16 @@
>   const char *call_count_text;
>   struct cgraph_node *final_caller = edge->caller;
>
> +  if (flag_opt_info < OPT_INFO_MED)
> +    {
> +      tree decl = edge->caller->decl;
> +      if (decl)
> +       {
> +         struct function *fn = DECL_STRUCT_FUNCTION (decl);
> +         if (!fn || !fn->always_inline_functions_inlined)
> +           return;
> +       }
> +    }
>   if (final_caller->global.inlined_to != NULL)
>     inline_chain_text = cgraph_node_call_chain (final_caller, &final_caller);
>   else



More information about the Gcc-patches mailing list