Here is the new patch.

Thanks,
Dehao

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);
@@ -354,6 +354,9 @@
   return buf;
 }

+/* File static variable to denote if it is in ipa-inline pass. */
+static bool is_in_ipa_inline = false;
+
 /* Dump the inline decision of EDGE to stderr.  */

 static void
@@ -364,6 +367,8 @@
   const char *call_count_text;
   struct cgraph_node *final_caller = edge->caller;

+  if (flag_opt_info < OPT_INFO_MED && !is_in_ipa_inline)
+    return;
   if (final_caller->global.inlined_to != NULL)
     inline_chain_text = cgraph_node_call_chain (final_caller, &final_caller);
   else
@@ -1193,6 +1198,8 @@
   int min_size, max_size;
   VEC (cgraph_edge_p, heap) *new_indirect_edges = NULL;

+  is_in_ipa_inline = true;
+
   if (flag_indirect_inlining)
     new_indirect_edges = VEC_alloc (cgraph_edge_p, heap, 8);

On Fri, Jan 6, 2012 at 1:39 PM, Xinliang David Li <davi...@google.com> wrote:
> Not ideal but better. Ok with this change.
>
> David
>
> On Thu, Jan 5, 2012 at 5:47 PM, Dehao Chen <de...@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 <davi...@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 <de...@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  <de...@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

Reply via email to