A recent patch decreased GCC's memory consumption.

gcctest@suse.de gcctest@suse.de
Wed Feb 28 05:55: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: 7384k -> 7383k
    Peak memory use before GGC: 2269k
    Peak memory use after GGC: 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 446k
    Leak: 2292k
    Overhead: 456k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7400k -> 7399k
    Peak memory use before GGC: 2297k
    Peak memory use after GGC: 1986k
    Maximum of released memory in single GGC run: 311k
    Garbage: 449k
    Leak: 2325k
    Overhead: 461k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 7512k -> 7515k
    Peak memory use before GGC: 2269k
    Peak memory use after GGC: 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 452k
    Leak: 2295k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 7520k -> 7519k
    Peak memory use before GGC: 2270k
    Peak memory use after GGC: 1959k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2295k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7520k -> 7519k
    Peak memory use before GGC: 2270k
    Peak memory use after GGC: 1959k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2295k
    Overhead: 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17880k -> 17879k
    Peak memory use before GGC: 9277k
    Peak memory use after GGC: 8859k
    Maximum of released memory in single GGC run: 2584k
    Garbage: 37118k
    Leak: 6579k
    Overhead: 5037k
    GGC runs: 279

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19892k -> 19891k
    Peak memory use before GGC: 10887k
    Peak memory use after GGC: 10519k
    Maximum of released memory in single GGC run: 2355k
    Garbage: 37710k
    Leak: 9480k
    Overhead: 5744k
    GGC runs: 269

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35284k -> 35283k
    Peak memory use before GGC: 19350k
    Peak memory use after GGC: 19135k
    Maximum of released memory in single GGC run: 2170k
    Garbage: 57434k
    Leak: 6616k
    Overhead: 6375k
    GGC runs: 351

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37592k -> 37587k
    Peak memory use before GGC: 19387k
    Peak memory use after GGC: 19185k
    Maximum of released memory in single GGC run: 2158k
    Garbage: 68704k
    Leak: 6725k
    Overhead: 7999k
    GGC runs: 403

comparing combine.c compilation at -O3 level:
    Overall memory needed: 46972k -> 46971k
    Peak memory use before GGC: 20423k
    Peak memory use after GGC: 19542k
    Maximum of released memory in single GGC run: 3130k
    Garbage: 101173k
    Leak: 6861k
    Overhead: 12237k
    GGC runs: 454

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 103216k -> 103215k
    Peak memory use before GGC: 68882k
    Peak memory use after GGC: 44737k
    Maximum of released memory in single GGC run: 36678k
    Garbage: 130211k
    Leak: 9350k
    Overhead: 16801k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 104616k -> 104611k
    Peak memory use before GGC: 70043k
    Peak memory use after GGC: 46005k
    Maximum of released memory in single GGC run: 36678k
    Garbage: 131174k
    Leak: 11298k
    Overhead: 17198k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 147616k -> 147607k
    Peak memory use before GGC: 85871k
    Peak memory use after GGC: 80078k
    Maximum of released memory in single GGC run: 32745k
    Garbage: 264141k
    Leak: 9410k
    Overhead: 27490k
    GGC runs: 225

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 191840k -> 193207k
    Peak memory use before GGC: 87187k
    Peak memory use after GGC: 80148k
    Maximum of released memory in single GGC run: 31097k
    Garbage: 298867k
    Leak: 9407k
    Overhead: 33067k
    GGC runs: 245

comparing insn-attrtab.c compilation at -O3 level:
  Ovarall memory allocated via mmap and sbrk decreased from 200156k to 191159k, overall -4.71%
    Overall memory needed: 200156k -> 191159k
    Peak memory use before GGC: 87204k
    Peak memory use after GGC: 80165k
    Maximum of released memory in single GGC run: 31097k
    Garbage: 299492k
    Leak: 9411k
    Overhead: 33261k
    GGC runs: 245

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 147689k -> 147673k
    Peak memory use before GGC: 90479k
    Peak memory use after GGC: 89583k
    Maximum of released memory in single GGC run: 18003k
    Garbage: 209330k
    Leak: 49053k
    Overhead: 23532k
    GGC runs: 414

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 165621k -> 165629k
    Peak memory use before GGC: 103211k
    Peak memory use after GGC: 102187k
    Maximum of released memory in single GGC run: 18485k
    Garbage: 215834k
    Leak: 72366k
    Overhead: 29426k
    GGC runs: 386

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 141921k
    Peak memory use before GGC: 101817k
    Peak memory use after GGC: 100800k
    Maximum of released memory in single GGC run: 17237k
    Garbage: 345862k
    Leak: 49773k
    Overhead: 30070k
    GGC runs: 529

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 143869k
    Peak memory use before GGC: 102489k
    Peak memory use after GGC: 101444k
    Maximum of released memory in single GGC run: 17234k
    Garbage: 374346k
    Leak: 50755k
    Overhead: 33972k
    GGC runs: 561

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 146657k
    Peak memory use before GGC: 104251k
    Peak memory use after GGC: 103218k
    Maximum of released memory in single GGC run: 17651k
    Garbage: 393319k
    Leak: 51057k
    Overhead: 35560k
    GGC runs: 577

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244756k -> 244755k
    Peak memory use before GGC: 80969k
    Peak memory use after GGC: 58708k
    Maximum of released memory in single GGC run: 44133k
    Garbage: 145362k
    Leak: 7619k
    Overhead: 24814k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 245580k -> 245579k
    Peak memory use before GGC: 81615k
    Peak memory use after GGC: 59354k
    Maximum of released memory in single GGC run: 44123k
    Garbage: 145629k
    Leak: 9387k
    Overhead: 25310k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 245980k -> 246095k
    Peak memory use before GGC: 85141k
    Peak memory use after GGC: 74853k
    Maximum of released memory in single GGC run: 36136k
    Garbage: 223655k
    Leak: 20863k
    Overhead: 30547k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 499236k -> 499351k
    Peak memory use before GGC: 79840k
    Peak memory use after GGC: 74854k
    Maximum of released memory in single GGC run: 33434k
    Garbage: 230701k
    Leak: 20953k
    Overhead: 32630k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1188604k -> 1189139k
    Peak memory use before GGC: 201756k
    Peak memory use after GGC: 190218k
    Maximum of released memory in single GGC run: 80702k
    Garbage: 376738k
    Leak: 46318k
    Overhead: 49361k
    GGC runs: 70

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-02-27 11:07:25.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-02-28 03:52:00.000000000 +0000
@@ -1,3 +1,109 @@
+2007-02-28  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* calls.c (emit_library_call_value_1): Handle partial registers
+	correctly when building up CALL_INSN_FUNCTION_USAGE.
+	
+2007-02-27  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+	* pa/predicates.md (move_src_operand): Allow zero for mode.
+	* pa/pa.md: Fix constraints for zero CONST_DOUBLE in 64-bit DFmode
+	move pattern.
+
+2007-02-27  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR target/30970
+	* config/i386/sse.md (*mov<mode>_internal, *movv4sf_internal,
+	*movv2df_internal): Enable pattern only for valid operand
+	combinations.
+	* config/i386/i386.c (ix86_modes_tieable_p): For SSE registers,
+	tie only 128bit modes. For MMX registers, tie only 64bit modes.
+
+2007-02-27  Mike Stump  <mrs@apple.com>
+
+	* config/darwin-crt3.c: Avoid compilation when compiling for a
+	kext multilib.
+
+2007-02-27  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile.in (PREPROCESSOR_DEFINES, test-protoize-simple): Define
+	FIXED_INCLUDE_DIR.
+	(stmp-int-hdrs, stmp-fixinc, install-headers): Use include-fixed
+	for fixed headers and limits.h.
+	(install-include-dir, install-headers-tar, install-headers-cpio,
+	install-headers-cp, real-install-headers-tar,
+	real-install-headers-cpio, real-install-headers-cp): Handle
+	include-fixed as well as include.
+	(install-mkheaders): Don't install files that go only in include
+	not include-fixed.
+	* cppdefault.c (cpp_include_defaults): Separate FIXED_INCLUDE_DIR
+	from GCC_INCLUDE_DIR.
+	* gcc.c (process_command): Remove special -BstageN/ handling.
+	(do_spec_1): Add include-fixed directories.
+
+2007-02-27  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* config/bfin/t-bfin-elf (LIB1ASMFUNCS): Add _umulsi3_highpart and
+	_smulsi3_highpart.
+	* config/bfin/lib1funcs.asm (___umulsi3_highpart, ___smulsi3_highpart):
+	New functions.
+	* config/bfin/bfin.md (smulsi3_highpart, umulsi3_highpart): New
+	patterns.
+
+2007-02-27  Mark Mitchell  <mark@codesourcery.com>
+
+	* c-common.c (get_priority): Add check for
+	SUPPORTS_INIT_PRIORITY.
+
+2007-02-27  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* config/bfin/bfin.md (doloop_end): FAIL if counter reg isn't SImode.
+
+	* config/bfin/bfin.c: Include "cfglayout.h".
+	(MAX_LSETUP_DISTANCE): New macro.
+	(struct loop_info): New members incoming, incoming_src and
+	incoming_dest.  Delete member predecessor.
+	(length_for_loop): New function.
+	(bfin_optimize_loop): Handle more different loop structures.
+	(bfin_discover_loop): Rework detection of predecessor blocks by
+	examining incoming edges.
+	(bfin_discover_loops, bfin_free_loops): New functions, broken out of
+	bfin_reorg_loops.
+	(bfin_reorder_loops): New function.
+	(bfin_reorg_loops): Use these three new functions.
+
+	* config/bfin/bfin.h (enum reg_class, REG_CLASS_NAMES,
+	REG_CLASS_CONTENTS): Add D0REGS through D7REGS.
+	(CONSTRAINT_LEN): Add entry for 'q'.
+	(REG_CLASS_FROM_CONSTRAINT): Renamed from REG_CLASS_FROM_LETTER.
+	Add 'q' constraints.
+	(REGNO_REG_CLASS): For R0 through R7, return corresponding regclass.
+	(CLASS_LIKELY_SPILLED_P): True for R0, R1 and R2.
+
+	* config/bfin/bfin.md (add_with_carry): New pattern.
+	(s_or_u, su_optab, su_modifier): New code macros/attrs.
+	(<su_optab>hisi_ll, <su_optab>hisi_lh, <su_optab>hisi_hl,
+	<su_optab>hisi_hh): Renamed from mulhisi_xx patterns; macroized to
+	support unsigned multiplies too.  Removed incorrect commutativity from
+	operand 1 constraint where appropriate.
+	(usmulhisi_ull, usmulhisi_ulh, usmulhisi_uhl, usmulhisi_uhh): New
+	patterns.
+	(<su_optab>hisi_ll_lh, <su_optab>hisi_ll_hl, <su_optab>hisi_ll_hh,
+	<su_optab>hisi_lh_hl, <su_optab>hisi_lh_hh, <su_optab>hisi_hl_hh):
+	New patterns.
+	(usmulhisi_ll_lul, usmulhisi_ll_luh, usmulhisi_ll_hul,
+	usmulhisi_ll_huh, usmulhisi_lh_lul, usmulhisi_lh_luh, usmulhisi_lh_hul,
+	usmulhisi_lh_huh, usmulhisi_hl_lul, usmulhisi_hl_luh, usmulhisi_hl_hul,
+	usmulhisi_hl_huh, usmulhisi_hh_lul, usmulhisi_hh_luh, usmulhisi_hh_hul,
+	usmulhisi_hh_huh): New patterns.
+
+	* config/bfin/bfin.md (ssashiftv2hi3, ssashifthi3, lshiftv2hi3,
+	lshifthi3): Fix output template to use half reg for operand 2.
+
+	* config/bfin/bfin.c (bfin_output_mi_thunk): Use R3 as scratch reg
+	instead of R2.
+
+	* config/bfin/bfin.md (rotl16, rotlsi3, rotrsi3): New patterns.
+
 2007-02-27  Andreas Schwab  <schwab@suse.de>
 
 	* Makefile.in (TEXI_GCCINSTALL_FILES): Add gcc-common.texi.


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