A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Tue Oct 2 16:48: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: 7041k -> 7042k
    Peak memory use before GGC: 1180k
    Peak memory use after GGC: 1079k
    Maximum of released memory in single GGC run: 126k
    Garbage: 249k
    Leak: 1084k
    Overhead: 141k
    GGC runs: 4

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7057k -> 7058k
    Peak memory use before GGC: 1207k
    Peak memory use after GGC: 1107k
    Maximum of released memory in single GGC run: 128k
    Garbage: 252k
    Leak: 1116k
    Overhead: 145k
    GGC runs: 4

comparing empty function compilation at -O1 level:
    Overall memory needed: 7097k -> 7098k
    Peak memory use before GGC: 1180k
    Peak memory use after GGC: 1071k
    Maximum of released memory in single GGC run: 121k
    Garbage: 251k
    Leak: 1084k
    Overhead: 141k
    GGC runs: 3

comparing empty function compilation at -O2 level:
    Overall memory needed: 7101k -> 7102k
    Peak memory use before GGC: 1180k
    Peak memory use after GGC: 1072k
    Maximum of released memory in single GGC run: 121k
    Garbage: 255k
    Leak: 1085k
    Overhead: 142k
    GGC runs: 3

comparing empty function compilation at -O3 level:
    Overall memory needed: 7101k -> 7102k
    Peak memory use before GGC: 1180k
    Peak memory use after GGC: 1072k
    Maximum of released memory in single GGC run: 121k
    Garbage: 255k
    Leak: 1085k
    Overhead: 142k
    GGC runs: 3

comparing combine.c compilation at -O0 level:
    Overall memory needed: 22045k -> 22034k
    Peak memory use before GGC: 8285k
    Peak memory use after GGC: 7624k
    Maximum of released memory in single GGC run: 1580k
    Garbage: 38810k
    Leak: 6169k
    Overhead: 5021k
    GGC runs: 369

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 24057k -> 24046k
    Peak memory use before GGC: 10115k
    Peak memory use after GGC: 9389k
    Maximum of released memory in single GGC run: 1875k
    Garbage: 39134k
    Leak: 8996k
    Overhead: 5693k
    GGC runs: 343

comparing combine.c compilation at -O1 level:
    Overall memory needed: 33129k -> 33050k
    Peak memory use before GGC: 17056k
    Peak memory use after GGC: 16868k
    Maximum of released memory in single GGC run: 1379k
    Garbage: 52438k -> 52438k
    Leak: 6308k
    Overhead: 6002k -> 6002k
    GGC runs: 440

comparing combine.c compilation at -O2 level:
  Amount of memory still referenced at the end of compilation increased from 6632k to 6639k, overall 0.11%
    Overall memory needed: 35377k -> 35374k
    Peak memory use before GGC: 17127k
    Peak memory use after GGC: 16957k
    Maximum of released memory in single GGC run: 1335k
    Garbage: 71351k -> 71351k
    Leak: 6632k -> 6639k
    Overhead: 8254k -> 8254k
    GGC runs: 507

comparing combine.c compilation at -O3 level:
    Overall memory needed: 38805k -> 38818k
    Peak memory use before GGC: 17337k
    Peak memory use after GGC: 17010k
    Maximum of released memory in single GGC run: 2130k
    Garbage: 92736k -> 92736k
    Leak: 6750k
    Overhead: 10759k -> 10759k
    GGC runs: 537

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 138505k -> 138158k
    Peak memory use before GGC: 58644k
    Peak memory use after GGC: 32137k
    Maximum of released memory in single GGC run: 34144k
    Garbage: 131586k
    Leak: 8909k
    Overhead: 14830k
    GGC runs: 295

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 139757k -> 139410k
    Peak memory use before GGC: 59793k
    Peak memory use after GGC: 33286k
    Maximum of released memory in single GGC run: 34144k
    Garbage: 132063k
    Leak: 10345k
    Overhead: 15211k
    GGC runs: 291

comparing insn-attrtab.c compilation at -O1 level:
  Overall memory allocated via mmap and sbrk increased from 149733k to 153542k, overall 2.54%
    Overall memory needed: 149733k -> 153542k
    Peak memory use before GGC: 57137k
    Peak memory use after GGC: 50907k
    Maximum of released memory in single GGC run: 24233k
    Garbage: 212481k
    Leak: 9801k
    Overhead: 24835k
    GGC runs: 319

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 187277k -> 187058k
    Peak memory use before GGC: 57772k
    Peak memory use after GGC: 52500k
    Maximum of released memory in single GGC run: 22973k
    Garbage: 253948k
    Leak: 10889k
    Overhead: 30581k
    GGC runs: 350

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 194521k -> 194258k
    Peak memory use before GGC: 69771k
    Peak memory use after GGC: 63204k
    Maximum of released memory in single GGC run: 23494k
    Garbage: 281995k
    Leak: 10925k
    Overhead: 32460k
    GGC runs: 356

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 155275k -> 155296k
    Peak memory use before GGC: 89788k
    Peak memory use after GGC: 88895k
    Maximum of released memory in single GGC run: 18062k
    Garbage: 210332k
    Leak: 53116k
    Overhead: 26510k
    GGC runs: 418

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 174647k -> 174656k
    Peak memory use before GGC: 101232k
    Peak memory use after GGC: 100230k
    Maximum of released memory in single GGC run: 18248k
    Garbage: 215932k
    Leak: 74940k
    Overhead: 31918k
    GGC runs: 392

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 121299k -> 121315k
    Peak memory use before GGC: 88656k
    Peak memory use after GGC: 87774k
    Maximum of released memory in single GGC run: 17318k
    Garbage: 292149k
    Leak: 52378k
    Overhead: 30190k
    GGC runs: 510

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 126307k -> 126351k
    Peak memory use before GGC: 88756k
    Peak memory use after GGC: 87875k
    Maximum of released memory in single GGC run: 17315k
    Garbage: 357853k
    Leak: 53383k
    Overhead: 37117k
    GGC runs: 591

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 130851k -> 130899k
    Peak memory use before GGC: 89973k
    Peak memory use after GGC: 89079k
    Maximum of released memory in single GGC run: 17671k
    Garbage: 389837k
    Leak: 53814k
    Overhead: 39848k
    GGC runs: 611

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 379339k
    Peak memory use before GGC: 101510k
    Peak memory use after GGC: 57163k
    Maximum of released memory in single GGC run: 50582k
    Garbage: 179454k
    Leak: 6299k
    Overhead: 30876k
    GGC runs: 105

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 380147k -> 380143k
    Peak memory use before GGC: 102144k
    Peak memory use after GGC: 57797k
    Maximum of released memory in single GGC run: 50583k
    Garbage: 179559k
    Leak: 8007k
    Overhead: 31342k
    GGC runs: 110

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 297529k -> 297614k
    Peak memory use before GGC: 81062k
    Peak memory use after GGC: 73201k
    Maximum of released memory in single GGC run: 40265k
    Garbage: 236192k
    Leak: 15698k
    Overhead: 31631k
    GGC runs: 103

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 270693k -> 270702k
    Peak memory use before GGC: 78187k
    Peak memory use after GGC: 73201k
    Maximum of released memory in single GGC run: 33868k
    Garbage: 246253k
    Leak: 15788k
    Overhead: 33704k
    GGC runs: 116

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1058229k -> 1055822k
    Peak memory use before GGC: 136332k
    Peak memory use after GGC: 126665k
    Maximum of released memory in single GGC run: 68197k
    Garbage: 364426k
    Leak: 26574k
    Overhead: 46311k
    GGC runs: 102

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-10-01 22:04:15.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-10-02 14:25:02.000000000 +0000
@@ -1,3 +1,83 @@
+2007-09-02  Kenneth Zadeck <zadeck@naturalbridge.com>
+
+	* ra-conflict.c: New file.
+	* ra.h: New file.
+	* reload.c (push_reload, find_dummy_reload): Change DF_RA_LIVE
+	usage to DF_LIVE usage.
+	* rtlanal.c (subreg_nregs_with_regno): New function.  
+	* df-scan.c (df_def_record_1, df_uses_record): Add code to set
+	DF_REF_EXTRACT, DF_REF_STRICT_LOWER_PART, and DF_REF_SUBREG flags.
+	(df_has_eh_preds): Removed.
+	(df_bb_refs_collect, df_bb_refs_collect, df_bb_refs_collect,
+	df_exit_block_uses_collect): Changed call from df_has_eh_preds to
+	bb_has_eh_pred.
+	* global.c (allocno, max_allocno, conflicts, allocno_row_words,
+	reg_allocno, EXECUTE_IF_SET_IN_ALLOCNO_SET): Moved to ra.h
+	(SET_ALLOCNO_LIVE, CLEAR_ALLOCNO_LIVE): Moved to ra-conflicts.c.
+	(regs_set, record_one_conflict, record_conflicts, mark_reg_store,
+	mark_reg_clobber, mark_reg_conflicts, mark_reg_death): Deleted.
+	(global_alloc): Turn off rescanning insns after call to
+	global_conflicts and added call to set_preferences.
+	(global_conflicts): Moved to ra-alloc.c.
+	(set_preferences_1, set_preferences): New function.
+	(mirror_conflicts): Changed types for various variables.
+	(mark_elimination): Change DF_RA_LIVE
+	usage to DF_LIVE usage.
+	(build_insn_chain): Rewritten from scratch and made local.
+	(print_insn_chain, print_insn_chains): New functions.
+	(dump_conflicts): Do not print conflicts for fixed_regs.
+	(rest_of_handle_global_alloc): Turn off insn rescanning.
+	* hard-reg-set.h: Fixed comment.
+	* local-alloc.c (update_equiv_regs): Change DF_RA_LIVE
+	usage to DF_LIVE usage and delete refs to TOP sets.
+	(block_alloc): Mark regs as live if they are in the artificial
+	defs at top of block.
+	(find_stack_regs): New function.
+	(rest_of_handle_local_alloc): Changed urec problem to live
+	problem and do not turn off df rescanning.
+	* df.h (DF_UREC, DF_UREC_BB_INFO, DF_LIVE_TOP, DF_RA_LIVE_IN,
+	DF_RA_LIVE_TOP, DF_RA_LIVE_OUT, df_urec_bb_info, df_urec,
+	df_urec_add_problem, df_urec_get_bb_info, df_has_eh_preds): Removed.
+	(DF_CHAIN, DF_NOTE, DF_CHAIN): Renumbered.
+	(DF_REF_EXTRACT, DF_REF_STRICT_LOWER_PART, DF_REF_SUBREG): New
+	fields in df_ref_flags.  The rest have been renumbered.  
+	* init-regs.c (initialize_uninitialized_regs): Enhanced debugging
+	at -O1.
+	* rtl.h (subreg_nregs_with_regno): New function.
+	* df-problems.c: (df_get_live_out, df_get_live_in,
+	df_get_live_top): Removed reference to DF_RA_LIVE.
+	(df_lr_reset, df_lr_transfer_function, df_live_free_bb_info,
+	df_live_alloc, df_live_reset, df_live_local_finalize,
+	df_live_free): Make top set only if different from in set.
+	(df_lr_top_dump, df_live_top_dump): Only print top set if
+	different from in set.
+	(df_lr_bb_local_compute): Removed unnecessary check.
+	(df_urec_problem_data, df_urec_set_bb_info, df_urec_free_bb_info, 
+	df_urec_alloc, df_urec_mark_reg_change, earlyclobber_regclass, 
+	df_urec_check_earlyclobber, df_urec_mark_reg_use_for_earlyclobber,
+	df_urec_mark_reg_use_for_earlyclobber_1, df_urec_bb_local_compute,
+	df_urec_local_compute, df_urec_init, df_urec_local_finalize, 
+	df_urec_confluence_n, df_urec_transfer_function, df_urec_free, 
+	df_urec_top_dump, df_urec_bottom_dump, problem_UREC,
+	df_urec_add_problem): Removed.
+	(df_simulate_fixup_sets): Changed call from df_has_eh_preds to
+	bb_has_eh_pred. 
+	* Makefile.in (ra-conflict.o, ra.h): New dependencies.
+	* basic_block.h (bb_has_abnormal_pred): New function.
+	* reload1.c (compute_use_by_pseudos): Change DF_RA_LIVE
+	usage to DF_LIVE usage.
+	
+2007-10-02  Revital Eres  <eres@il.ibm.com>
+
+	* config/rs6000/predicates.md (easy_vector_constant): Return false
+	for 750CL paired vectors.
+	* config/rs6000/paired.md (movv2sf_paired): Fix move of easy
+	vector constant.
+	(vec_initv2sf): Add new description.
+	(vconcatsf): Likewise.
+	* config/rs6000/rs6000-protos.h: Declare paired_expand_vector_init.
+	* config/rs6000/rs6000.c (paired_expand_vector_init): New function.
+
 2007-10-01  Alexandre Oliva  <aoliva@redhat.com>
 
 	* tree-ssa-sink.c (sink_code_in_bb): Don't stop sinking after


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