From: Andi Kleen <a...@linux.intel.com> For parallel LTO builds setting -fmem-report does not work very well because all the LTRANS phases dump it in parallel and typically interleave it to unreadability.
Since usually the memory bottleneck is WPA add a flag to only dump the memory report for that. Passed bootstrap and testsuite on x86_64. 2012-09-06 Andi Kleen <a...@my.domain.org> * gcc/common.opt (-fmem-report-wpa): Add * gcc/doc/invoke.texi (-fmem-report-wpa): Document. * gcc/lto/lto.c (do_whole_program_analysis): Run mem_report when mem_report_wpa is set. --- gcc/common.opt | 4 ++++ gcc/doc/invoke.texi | 7 ++++++- gcc/lto/lto.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/gcc/common.opt b/gcc/common.opt index 87e28b5..73eebf4 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1470,6 +1470,10 @@ fmem-report Common Report Var(mem_report) Report on permanent memory allocation +fmem-report-wpa +Common Report Var(mem_report_wpa) +Report on permanent memory allocation in WPA only + ; This will attempt to merge constant section constants, if 1 only ; string constants and constants from constant pool, if 2 also constant ; variables. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6cf7cec..5a5f9d2 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -328,7 +328,7 @@ Objective-C and Objective-C++ Dialects}. -feliminate-unused-debug-symbols -femit-class-debug-always @gol -fenable-@var{kind}-@var{pass} @gol -fenable-@var{kind}-@var{pass}=@var{range-list} @gol --fdebug-types-section @gol +-fdebug-types-section -fmem-report-wpa @gol -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol @@ -5132,6 +5132,11 @@ pass when it finishes. Makes the compiler print some statistics about permanent memory allocation when it finishes. +@item -fmem-report-wpa +@opindex fmem-report-wpa +Makes the compiler print some statistics about permanent memory +allocation for the WPA phase only. + @item -fpre-ipa-mem-report @opindex fpre-ipa-mem-report @item -fpost-ipa-mem-report diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 5da5412..3c59299 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -2016,6 +2016,8 @@ do_whole_program_analysis (void) /* Show the LTO report before launching LTRANS. */ if (flag_lto_report) print_lto_report (); + if (mem_report_wpa) + dump_mem_report (); } -- 1.7.7