diff mbox

[google] Dump inline decisions more wisely

Message ID CAO2gOZUtU=wr0+YX6ZP1wgDW6bxDkad8GeMmOoSoSx4y0z3=xQ@mail.gmail.com
State New
Headers show

Commit Message

Dehao Chen Jan. 4, 2012, 9:12 a.m. UTC
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

Comments

Xinliang David Li Jan. 5, 2012, 5:46 p.m. UTC | #1
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
Dehao Chen Jan. 6, 2012, 1:47 a.m. UTC | #2
Or use a new global variable to denote whether it's in early-inline or
ipa-inline?

Dehao

On Fri, Jan 6, 2012 at 1:46 AM, Xinliang David Li <davidxl@google.com> wrote:
>
> 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
Xinliang David Li Jan. 6, 2012, 5:39 a.m. UTC | #3
Not ideal but better. Ok with this change.

David

On Thu, Jan 5, 2012 at 5:47 PM, Dehao Chen <dehao@google.com> wrote:
> Or use a new global variable to denote whether it's in early-inline or
> ipa-inline?
>
> Dehao
>
> On Fri, Jan 6, 2012 at 1:46 AM, Xinliang David Li <davidxl@google.com> wrote:
>>
>> 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
diff mbox

Patch

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