Patchwork [google] change dump_inline_decisions to make it print more useful and better looking info

login
register
mail settings
Submitter Dehao Chen
Date Dec. 30, 2011, 8:31 a.m.
Message ID <CAO2gOZXVJR35icDd+R3Sp=mj9OjTcbXRnWjO7+S5VhMuCLma4A@mail.gmail.com>
Download mbox | patch
Permalink /patch/133621/
State New
Headers show

Comments

Dehao Chen - Dec. 30, 2011, 8:31 a.m.
Hi,

This patch makes the -fopt-info print more concise info:
1. only inline decisions after einline are printed
2. print in a more compact format

Bootstrapped with no problem.

Is it okay for google-4_6 and google-main branch?

Thanks,
Dehao

gcc/ChangeLog.google-4_6
2011-12-30  Dehao Chen  <dehao@google.com>

	* ipa-inline.c (dump_inline_decision): Print more concise info when
	dumping inline decisions.
Xinliang David Li - Dec. 30, 2011, 8:59 a.m.
the early inline decisions are still good to dump out. However the
opt-info should check 'if (profile_info)' to decide if count and max
count info need to be dumped.

David

On Fri, Dec 30, 2011 at 12:31 AM, Dehao Chen <dehao@google.com> wrote:
> Hi,
>
> This patch makes the -fopt-info print more concise info:
> 1. only inline decisions after einline are printed
> 2. print in a more compact format
>
> Bootstrapped with no problem.
>
> Is it okay for google-4_6 and google-main branch?
>
> Thanks,
> Dehao
>
> gcc/ChangeLog.google-4_6
> 2011-12-30  Dehao Chen  <dehao@google.com>
>
>        * ipa-inline.c (dump_inline_decision): Print more concise info when
>        dumping inline decisions.
>
> Index: gcc/ipa-inline.c
> ===================================================================
> --- gcc/ipa-inline.c    (revision 182739)
> +++ gcc/ipa-inline.c    (working copy)
> @@ -303,26 +303,19 @@
>   char *buf;
>   size_t buf_size;
>   const char *bfd_name = lang_hooks.dwarf_name (node->decl, 0);
> -  const char *count_text = "count=";
> -  const char *max_count_text = "max_count=";
>
>   if (!bfd_name)
>     bfd_name = "unknown";
>
>   buf_size = strlen (bfd_name) + 1;
>   if (flag_opt_info >= OPT_INFO_MED)
> -    buf_size += (strlen (count_text) + MAX_INT_LENGTH + 1);
> -  if (flag_opt_info >= OPT_INFO_MAX)
> -    buf_size += (strlen (max_count_text) + MAX_INT_LENGTH + 1);
> +    buf_size += (2 * MAX_INT_LENGTH + 5);
>   buf = (char *) xmalloc (buf_size);
>
>   strcpy (buf, bfd_name);
>   if (flag_opt_info >= OPT_INFO_MED)
> -    sprintf (buf, "%s,%s"HOST_WIDEST_INT_PRINT_DEC,
> -            buf, count_text, node->count);
> -  if (flag_opt_info >= OPT_INFO_MAX)
> -    sprintf (buf, "%s,%s"HOST_WIDEST_INT_PRINT_DEC,
> -            buf, max_count_text, node->max_bb_count);
> +    sprintf (buf, "("HOST_WIDEST_INT_PRINT_DEC", "HOST_WIDEST_INT_PRINT_DEC")",
> +            node->count, node->max_bb_count);
>   return buf;
>  }
>
> @@ -369,6 +362,14 @@
>   const char *inline_chain_text;
>   const char *call_count_text;
>   struct cgraph_node *final_caller = edge->caller;
> +  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);

Patch

Index: gcc/ipa-inline.c
===================================================================
--- gcc/ipa-inline.c	(revision 182739)
+++ gcc/ipa-inline.c	(working copy)
@@ -303,26 +303,19 @@ 
   char *buf;
   size_t buf_size;
   const char *bfd_name = lang_hooks.dwarf_name (node->decl, 0);
-  const char *count_text = "count=";
-  const char *max_count_text = "max_count=";

   if (!bfd_name)
     bfd_name = "unknown";

   buf_size = strlen (bfd_name) + 1;
   if (flag_opt_info >= OPT_INFO_MED)
-    buf_size += (strlen (count_text) + MAX_INT_LENGTH + 1);
-  if (flag_opt_info >= OPT_INFO_MAX)
-    buf_size += (strlen (max_count_text) + MAX_INT_LENGTH + 1);
+    buf_size += (2 * MAX_INT_LENGTH + 5);
   buf = (char *) xmalloc (buf_size);

   strcpy (buf, bfd_name);
   if (flag_opt_info >= OPT_INFO_MED)
-    sprintf (buf, "%s,%s"HOST_WIDEST_INT_PRINT_DEC,
-	     buf, count_text, node->count);
-  if (flag_opt_info >= OPT_INFO_MAX)
-    sprintf (buf, "%s,%s"HOST_WIDEST_INT_PRINT_DEC,
-	     buf, max_count_text, node->max_bb_count);
+    sprintf (buf, "("HOST_WIDEST_INT_PRINT_DEC", "HOST_WIDEST_INT_PRINT_DEC")",
+	     node->count, node->max_bb_count);
   return buf;
 }

@@ -369,6 +362,14 @@ 
   const char *inline_chain_text;
   const char *call_count_text;
   struct cgraph_node *final_caller = edge->caller;
+  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);