A recent patch increased GCC's memory consumption in some cases!

gcctest@suse.de gcctest@suse.de
Tue Jul 10 11:27:00 GMT 2007


Hi,

I am a friendly script caring about memory consumption in GCC.  Please
contact jh@suse.cz if something is going wrong.

Comparing memory consumption on compilation of combine.i, insn-attrtab.i,
and generate-3.4.ii I got:


comparing empty function compilation at -O0 level:
    Overall memory needed: 8331k
    Peak memory use before GGC: 3357k
    Peak memory use after GGC: 3021k
    Maximum of released memory in single GGC run: 336k
    Garbage: 491k
    Leak: 3754k
    Overhead: 875k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 8347k
    Peak memory use before GGC: 3385k
    Peak memory use after GGC: 3048k
    Maximum of released memory in single GGC run: 337k
    Garbage: 493k
    Leak: 3787k
    Overhead: 879k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 8367k
    Peak memory use before GGC: 3357k
    Peak memory use after GGC: 3021k
    Maximum of released memory in single GGC run: 336k
    Garbage: 496k
    Leak: 3757k
    Overhead: 875k
    GGC runs: 3

comparing empty function compilation at -O2 level:
    Overall memory needed: 8399k
    Peak memory use before GGC: 3358k
    Peak memory use after GGC: 3021k
    Maximum of released memory in single GGC run: 337k
    Garbage: 500k
    Leak: 3757k
    Overhead: 876k
    GGC runs: 3

comparing empty function compilation at -O3 level:
    Overall memory needed: 8399k
    Peak memory use before GGC: 3358k
    Peak memory use after GGC: 3021k
    Maximum of released memory in single GGC run: 337k
    Garbage: 500k
    Leak: 3757k
    Overhead: 876k
    GGC runs: 3

comparing combine.c compilation at -O0 level:
    Overall memory needed: 23739k
    Peak memory use before GGC: 10293k
    Peak memory use after GGC: 9510k
    Maximum of released memory in single GGC run: 1908k
    Garbage: 38897k -> 38902k
    Leak: 8672k
    Overhead: 5362k -> 5362k
    GGC runs: 251

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 25623k
    Peak memory use before GGC: 11956k
    Peak memory use after GGC: 11301k
    Maximum of released memory in single GGC run: 1516k
    Garbage: 39206k -> 39211k
    Leak: 11565k
    Overhead: 6068k -> 6068k
    GGC runs: 251

comparing combine.c compilation at -O1 level:
    Overall memory needed: 37475k -> 37483k
    Peak memory use before GGC: 18940k
    Peak memory use after GGC: 18748k
    Maximum of released memory in single GGC run: 1372k -> 1373k
    Garbage: 53200k -> 53248k
    Leak: 8729k -> 8730k
    Overhead: 6463k -> 6483k
    GGC runs: 326

comparing combine.c compilation at -O2 level:
    Overall memory needed: 39491k -> 39519k
    Peak memory use before GGC: 18994k
    Peak memory use after GGC: 18804k
    Maximum of released memory in single GGC run: 1398k -> 1406k
    Garbage: 72381k -> 72402k
    Leak: 8845k -> 8847k
    Overhead: 8787k -> 8789k
    GGC runs: 389 -> 390

comparing combine.c compilation at -O3 level:
    Overall memory needed: 41835k -> 41839k
    Peak memory use before GGC: 19248k -> 19246k
    Peak memory use after GGC: 18932k -> 18931k
    Maximum of released memory in single GGC run: 2209k -> 2208k
    Garbage: 94258k -> 94312k
    Leak: 8966k -> 8960k
    Overhead: 11501k -> 11529k
    GGC runs: 417

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 143323k
    Peak memory use before GGC: 61019k
    Peak memory use after GGC: 34025k
    Maximum of released memory in single GGC run: 34625k
    Garbage: 132717k -> 132743k
    Leak: 11189k
    Overhead: 14754k -> 14754k
    GGC runs: 196

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 144575k
    Peak memory use before GGC: 62181k
    Peak memory use after GGC: 35185k
    Maximum of released memory in single GGC run: 34626k
    Garbage: 132946k -> 132964k
    Leak: 12898k
    Overhead: 15151k
    GGC runs: 200

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 153751k -> 153715k
    Peak memory use before GGC: 59276k
    Peak memory use after GGC: 55051k
    Maximum of released memory in single GGC run: 23587k -> 23586k
    Garbage: 218355k -> 218540k
    Leak: 11321k -> 11321k
    Overhead: 25147k -> 25174k
    GGC runs: 228

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 192291k -> 192295k
    Peak memory use before GGC: 59158k
    Peak memory use after GGC: 55111k
    Maximum of released memory in single GGC run: 21339k -> 21338k
    Garbage: 254255k -> 254461k
    Leak: 11315k -> 11314k
    Overhead: 30795k -> 30817k
    GGC runs: 253

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 198179k -> 198187k
    Peak memory use before GGC: 71558k
    Peak memory use after GGC: 65945k
    Maximum of released memory in single GGC run: 22949k
    Garbage: 283292k -> 283495k
    Leak: 11323k -> 11323k
    Overhead: 32508k -> 32533k
    GGC runs: 256

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 156095k -> 156103k
    Peak memory use before GGC: 91028k -> 91029k
    Peak memory use after GGC: 90127k -> 90128k
    Maximum of released memory in single GGC run: 17976k -> 17977k
    Garbage: 209468k -> 209475k
    Leak: 53737k
    Overhead: 24584k -> 24584k
    GGC runs: 396

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 177167k -> 177163k
    Peak memory use before GGC: 103942k -> 103943k
    Peak memory use after GGC: 102912k -> 102913k
    Maximum of released memory in single GGC run: 18638k
    Garbage: 215306k -> 215313k
    Leak: 77165k
    Overhead: 30551k -> 30551k
    GGC runs: 373

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 153151k -> 153139k
    Peak memory use before GGC: 103043k -> 103049k
    Peak memory use after GGC: 101948k
    Maximum of released memory in single GGC run: 17386k -> 17387k
    Garbage: 331095k -> 331097k
    Leak: 53850k -> 53851k
    Overhead: 30757k -> 30757k
    GGC runs: 501 -> 500

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 163843k -> 163811k
    Peak memory use before GGC: 103620k -> 103627k
    Peak memory use after GGC: 102586k -> 102590k
    Maximum of released memory in single GGC run: 17385k -> 17386k
    Garbage: 389465k -> 389298k
    Leak: 54539k -> 54540k
    Overhead: 37495k -> 37471k
    GGC runs: 558 -> 559

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 168315k -> 168343k
    Peak memory use before GGC: 105923k -> 105921k
    Peak memory use after GGC: 104874k -> 104872k
    Maximum of released memory in single GGC run: 17762k
    Garbage: 433392k -> 433035k
    Leak: 55241k -> 55234k
    Overhead: 41274k -> 41160k
    GGC runs: 583

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 387671k
    Peak memory use before GGC: 103448k
    Peak memory use after GGC: 59101k
    Maximum of released memory in single GGC run: 50583k
    Garbage: 179419k
    Leak: 8939k
    Overhead: 31381k
    GGC runs: 64

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 388463k
    Peak memory use before GGC: 104094k
    Peak memory use after GGC: 59748k
    Maximum of released memory in single GGC run: 50582k
    Garbage: 179523k
    Leak: 10707k
    Overhead: 31877k
    GGC runs: 72

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 308111k -> 308175k
    Peak memory use before GGC: 84295k
    Peak memory use after GGC: 75947k
    Maximum of released memory in single GGC run: 39284k
    Garbage: 232802k
    Leak: 22376k
    Overhead: 31894k
    GGC runs: 70

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 314939k -> 315083k
    Peak memory use before GGC: 80933k
    Peak memory use after GGC: 75947k
    Maximum of released memory in single GGC run: 33653k -> 33017k
    Garbage: 243851k
    Leak: 22457k
    Overhead: 34447k
    GGC runs: 84

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
  Ovarall memory allocated via mmap and sbrk decreased from 1965947k to 1031827k, overall -90.53%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 190538k to 184687k, overall -3.17%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 178054k to 172203k, overall -3.40%
  Amount of produced GGC garbage decreased from 389440k to 348399k, overall -11.78%
  Amount of memory still referenced at the end of compilation increased from 47091k to 47832k, overall 1.57%
    Overall memory needed: 1965947k -> 1031827k
    Peak memory use before GGC: 190538k -> 184687k
    Peak memory use after GGC: 178054k -> 172203k
    Maximum of released memory in single GGC run: 81025k -> 80995k
    Garbage: 389440k -> 348399k
    Leak: 47091k -> 47832k
    Overhead: 48668k -> 45175k
    GGC runs: 65 -> 66

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-07-09 16:42:17.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-07-10 09:24:01.000000000 +0000
@@ -1,3 +1,75 @@
+2007-07-10  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+	PR rtl-optimization/32664
+	* mode-switching.c (create_pre_exit): Skip barrier insns.
+
+2007-07-10  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* tree-scalar-evolution.c (scev_const_prop): Add arguments to
+	force_gimple_operand_bsi.
+	* tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr,
+	rewrite_use_compare): Ditto.
+	* tree-ssa-address.c (gimplify_mem_ref_parts, create_mem_ref):
+	Ditto.
+	* tree-ssa-ifcombine.c (ifcombine_ifandif): Ditto.
+	* tree-ssa-loop-prefetch.c (issue_prefetch_ref): Ditto.
+	* lambda-code.c (replace_uses_equiv_to_x_with_y): Ditto.
+	* tree-profile.c (prepare_instrumented_value,
+	tree_gen_interval_profiler, tree_gen_pow2_profiler,
+	tree_gen_one_value_profiler, tree_gen_ic_profiler,
+	tree_gen_ic_func_profiler, tree_gen_average_profiler,
+	tree_gen_ior_profiler): Ditto.
+	* tree-ssa-reassoc.c (negate_value): Ditto.
+	* matrix-reorg.c (transform_access_sites, transform_allocation_sites):
+	Use force_gimple_operand_bsi.
+	* tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto.
+	* tree-if-conv.c (add_to_dst_predicate_list,
+	find_phi_replacement_condition): Ditto.
+	* gimplify.c (force_gimple_operand_bsi): Add before and m arguments.
+	Call mark_symbols_for_renaming for new statements.
+	* tree-flow.h (force_gimple_operand_bsi): Declaration changed.
+
+2007-07-10  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* cfghooks.c (remove_edge): New function.
+	(redirect_edge_and_branch, remove_branch, merge_blocks): Updated
+	loop exit rescans.
+	* cfghooks.h (remove_edge): Declare.
+	* cfg.c (remove_edge): Renamed to remove_edge_raw.
+	* basic-block.h (remove_edge): Declaration changed to remove_edge_raw.
+
+2007-07-09  Wolfgang Gellerich  <gellerich@de.ibm.com>
+
+	* optabs.h: Added declaration for signbit_optab.  
+	* optabs.c: (init_optabs): Added initialization for signbit_optab.
+	* genoptinit.c (optabs): Added entry for signbit insns.  
+	* builtins.c (expand_builtin_signbit): Added code to use a signbit insn,
+	if available.  
+	* config/s390/s390.h (S390_TDC_SIGNBIT_SET): New constant.  
+	* config/s390/s390.md (signbit<mode>2): New expander.  
+
+2007-07-09  Richard Guenther  <rguenther@suse.de>
+
+	PR middle-end/32698
+	* fold-const.c (fold_plusminus_mult_expr): Move constant
+	arguments second to allow decomposing.
+
+2007-07-09  Alexandre Oliva  <aoliva@oliva.athome.lsd.ic.unicamp.br>
+
+	Revert:
+	2007-07-06  Alexandre Oliva  <aoliva@redhat.com>
+	PR debug/23551
+	* tree-ssa-copyrename.c (copy_rename_partition_coalesce):
+	Disregard DECL_FROM_INLINE.
+
+2007-07-09  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR target/27855
+	* doc/invoke.texi: Add ftree-reassoc flag.
+	* common.opt (ftree-reassoc): New flag.
+	* tree-ssa-reassoc.c (gate_tree_ssa_reassoc): New static function.
+	(struct tree_opt_pass pass_reassoc): Use gate_tree_ssa_reassoc.
+
 2007-07-09  Uros Bizjak  <ubizjak@gmail.com>
 
 	PR tree-optimization/32681
@@ -2848,7 +2920,7 @@
 2007-06-08  Harsha Jagasia <harsha.jagasia@amd.com>
 	    Tony Linthicum <tony.linthicum@amd.com>
 
-	* doc/extend.texi: Add fvect-cost-model flag.
+	* doc/invoke.texi: Add fvect-cost-model flag.
 	* common.opt (fvect-cost-model): New flag.
 	* tree-vectorizer.c (new_stmt_vec_info): Initialize inside and outside
 	cost fields in stmt_vec_info struct for STMT.


The results can be reproduced by building a compiler with

--enable-gather-detailed-mem-stats targetting x86-64

and compiling preprocessed combine.c or testcase from PR8632 with:

-fmem-report --param=ggc-min-heapsize=1024 --param=ggc-min-expand=1 -Ox -Q

The memory consumption summary appears in the dump after detailed listing
of the places they are allocated in.  Peak memory consumption is actually
computed by looking for maximal value in {GC XXXX -> YYYY} report.

Your testing script.



More information about the Gcc-regression mailing list