Patchwork [8/9] Print lto report at the right place

login
register
mail settings
Submitter Andi Kleen
Date April 19, 2013, 9:31 p.m.
Message ID <1366407117-18462-9-git-send-email-andi@firstfloor.org>
Download mbox | patch
Permalink /patch/238120/
State New
Headers show

Comments

Andi Kleen - April 19, 2013, 9:31 p.m.
From: Andi Kleen <ak@linux.intel.com>

The LTO report is currently printed when the type merging hash tables
are already destroyed, which makes them always show up as empty.
Print it earlier. Right now it's printed twice.

gcc/:

2013-04-19  Andi Kleen  <ak@linux.intel.com>

	* lto/lto.c (print_lto_report_1): Declare early.
	(read_cgraph_and_symbols): Call print_lto_report_1 early.
---
 gcc/lto/lto.c | 6 ++++++
 1 file changed, 6 insertions(+)
Richard Guenther - April 22, 2013, 11:52 a.m.
On Fri, Apr 19, 2013 at 11:31 PM, Andi Kleen <andi@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> The LTO report is currently printed when the type merging hash tables
> are already destroyed, which makes them always show up as empty.
> Print it earlier. Right now it's printed twice.

Ok if tested properly.

Thanks,
Richard.

> gcc/:
>
> 2013-04-19  Andi Kleen  <ak@linux.intel.com>
>
>         * lto/lto.c (print_lto_report_1): Declare early.
>         (read_cgraph_and_symbols): Call print_lto_report_1 early.
> ---
>  gcc/lto/lto.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
> index dbef690..893f4e5 100644
> --- a/gcc/lto/lto.c
> +++ b/gcc/lto/lto.c
> @@ -2906,6 +2906,8 @@ lto_flatten_files (struct lto_file_decl_data **orig, int count, int last_file_ix
>  static int real_file_count;
>  static GTY((length ("real_file_count + 1"))) struct lto_file_decl_data **real_file_decl_data;
>
> +static void print_lto_report_1 (void);
> +
>  /* Read all the symbols from the input files FNAMES.  NFILES is the
>     number of files requested in the command line.  Instantiate a
>     global call graph by aggregating all the sub-graphs found in each
> @@ -2999,6 +3001,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
>    if (resolution_file_name)
>      fclose (resolution);
>
> +  /* Show the LTO report before launching LTRANS.  */
> +  if (flag_lto_report || (flag_wpa && flag_lto_report_wpa))
> +    print_lto_report_1 ();
> +
>    /* Free gimple type merging datastructures.  */
>    htab_delete (gimple_types);
>    gimple_types = NULL;
> --
> 1.8.1.4
>

Patch

diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index dbef690..893f4e5 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -2906,6 +2906,8 @@  lto_flatten_files (struct lto_file_decl_data **orig, int count, int last_file_ix
 static int real_file_count;
 static GTY((length ("real_file_count + 1"))) struct lto_file_decl_data **real_file_decl_data;
 
+static void print_lto_report_1 (void);
+
 /* Read all the symbols from the input files FNAMES.  NFILES is the
    number of files requested in the command line.  Instantiate a
    global call graph by aggregating all the sub-graphs found in each
@@ -2999,6 +3001,10 @@  read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
   if (resolution_file_name)
     fclose (resolution);
 
+  /* Show the LTO report before launching LTRANS.  */
+  if (flag_lto_report || (flag_wpa && flag_lto_report_wpa))
+    print_lto_report_1 ();
+
   /* Free gimple type merging datastructures.  */
   htab_delete (gimple_types);
   gimple_types = NULL;