Patchwork [7/9] Add -flto-report-wpa

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

Comments

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

-flto-report is useful, but it prints for every LTRANS pass and
is very noisy and the main problem is often in WPA only.

Add a new -flto-report-wpa option that is only printed for WPA.

gcc/:

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

	* common.opt (-flto-report-wpa): Add.
	* doc/invoke.texi (-flto-report-wpa): Add.
	* lto/lto.c (do_whole_program_analysis): Check for lto-report-wpa.
	(lto_main): dito.
---
 gcc/common.opt      | 4 ++++
 gcc/doc/invoke.texi | 6 +++++-
 gcc/lto/lto.c       | 4 ++--
 3 files changed, 11 insertions(+), 3 deletions(-)
Richard Guenther - April 22, 2013, 11:53 a.m.
On Fri, Apr 19, 2013 at 11:31 PM, Andi Kleen <andi@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> -flto-report is useful, but it prints for every LTRANS pass and
> is very noisy and the main problem is often in WPA only.
>
> Add a new -flto-report-wpa option that is only printed for WPA.

Ok.

Thanks,
Richard.

> gcc/:
>
> 2013-04-19  Andi Kleen  <ak@linux.intel.com>
>
>         * common.opt (-flto-report-wpa): Add.
>         * doc/invoke.texi (-flto-report-wpa): Add.
>         * lto/lto.c (do_whole_program_analysis): Check for lto-report-wpa.
>         (lto_main): dito.
> ---
>  gcc/common.opt      | 4 ++++
>  gcc/doc/invoke.texi | 6 +++++-
>  gcc/lto/lto.c       | 4 ++--
>  3 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index f0cb9e8..8be32e5 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -1504,6 +1504,10 @@ flto-report
>  Common Report Var(flag_lto_report) Init(0)
>  Report various link-time optimization statistics
>
> +flto-report-wpa
> +Common Report Var(flag_lto_report_wpa) Init(0)
> +Report various link-time optimization statistics for WPA only
> +
>  fmath-errno
>  Common Report Var(flag_errno_math) Init(1) Optimization SetByCombined
>  Set errno after built-in math functions
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 782b569..034845d 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -379,7 +379,7 @@ Objective-C and Objective-C++ Dialects}.
>  -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
>  -floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize @gol
>  -floop-parallelize-all -flto -flto-compression-level @gol
> --flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
> +-flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol
>  -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
>  -fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
>  -fno-default-inline @gol
> @@ -8455,6 +8455,10 @@ files in LTO mode (via @option{-flto}).
>
>  Disabled by default.
>
> +@item -flto-report-wpa
> +Like @option{-flto-report}, but only print for the WPA phase of Link
> +Time Optimization.
> +
>  @item -fuse-linker-plugin
>  Enables the use of a linker plugin during link-time optimization.  This
>  option relies on plugin support in the linker, which is available in gold
> diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
> index 4aaf2dc..dbef690 100644
> --- a/gcc/lto/lto.c
> +++ b/gcc/lto/lto.c
> @@ -3287,7 +3287,7 @@ do_whole_program_analysis (void)
>      }
>
>    /* Show the LTO report before launching LTRANS.  */
> -  if (flag_lto_report)
> +  if (flag_lto_report || (flag_wpa && flag_lto_report_wpa))
>      print_lto_report_1 ();
>    if (mem_report_wpa)
>      dump_memory_report (true);
> @@ -3415,7 +3415,7 @@ lto_main (void)
>              print_lto_report before launching LTRANS.  If LTRANS was
>              launched directly by the driver we would not need to do
>              this.  */
> -         if (flag_lto_report)
> +         if (flag_lto_report || (flag_wpa && flag_lto_report_wpa))
>             print_lto_report_1 ();
>
>           /* Record the global variables.  */
> --
> 1.8.1.4
>

Patch

diff --git a/gcc/common.opt b/gcc/common.opt
index f0cb9e8..8be32e5 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1504,6 +1504,10 @@  flto-report
 Common Report Var(flag_lto_report) Init(0)
 Report various link-time optimization statistics
 
+flto-report-wpa
+Common Report Var(flag_lto_report_wpa) Init(0)
+Report various link-time optimization statistics for WPA only
+
 fmath-errno
 Common Report Var(flag_errno_math) Init(1) Optimization SetByCombined
 Set errno after built-in math functions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 782b569..034845d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -379,7 +379,7 @@  Objective-C and Objective-C++ Dialects}.
 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
 -floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize @gol
 -floop-parallelize-all -flto -flto-compression-level @gol
--flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
+-flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol
 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
 -fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
 -fno-default-inline @gol
@@ -8455,6 +8455,10 @@  files in LTO mode (via @option{-flto}).
 
 Disabled by default.
 
+@item -flto-report-wpa
+Like @option{-flto-report}, but only print for the WPA phase of Link
+Time Optimization.
+
 @item -fuse-linker-plugin
 Enables the use of a linker plugin during link-time optimization.  This
 option relies on plugin support in the linker, which is available in gold
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 4aaf2dc..dbef690 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -3287,7 +3287,7 @@  do_whole_program_analysis (void)
     }
 
   /* Show the LTO report before launching LTRANS.  */
-  if (flag_lto_report)
+  if (flag_lto_report || (flag_wpa && flag_lto_report_wpa))
     print_lto_report_1 ();
   if (mem_report_wpa)
     dump_memory_report (true);
@@ -3415,7 +3415,7 @@  lto_main (void)
 	     print_lto_report before launching LTRANS.  If LTRANS was
 	     launched directly by the driver we would not need to do
 	     this.  */
-	  if (flag_lto_report)
+	  if (flag_lto_report || (flag_wpa && flag_lto_report_wpa))
 	    print_lto_report_1 ();
 
 	  /* Record the global variables.  */