A recent patch decreased GCC's memory consumption.

gcctest@suse.de gcctest@suse.de
Fri Feb 9 22:13: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: 7383k
    Peak memory use before GGC: 2265k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 310k
    Garbage: 445k
    Leak: 2289k
    Overhead: 456k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7399k
    Peak memory use before GGC: 2293k
    Peak memory use after GGC: 1982k
    Maximum of released memory in single GGC run: 311k
    Garbage: 448k
    Leak: 2321k
    Overhead: 461k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 7495k
    Peak memory use before GGC: 2265k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 310k
    Garbage: 451k
    Leak: 2291k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 7507k
    Peak memory use before GGC: 2266k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 311k
    Garbage: 454k -> 454k
    Leak: 2291k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7507k
    Peak memory use before GGC: 2266k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 311k
    Garbage: 454k -> 454k
    Leak: 2291k
    Overhead: 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17731k
    Peak memory use before GGC: 9291k
    Peak memory use after GGC: 8871k
    Maximum of released memory in single GGC run: 2603k
    Garbage: 37162k
    Leak: 6539k
    Overhead: 5024k
    GGC runs: 280

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19823k
    Peak memory use before GGC: 10897k
    Peak memory use after GGC: 10531k
    Maximum of released memory in single GGC run: 2375k
    Garbage: 37738k
    Leak: 9415k
    Overhead: 5727k
    GGC runs: 270

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35155k -> 35163k
    Peak memory use before GGC: 19412k
    Peak memory use after GGC: 19206k
    Maximum of released memory in single GGC run: 2197k
    Garbage: 57374k
    Leak: 6562k
    Overhead: 6354k
    GGC runs: 349

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37567k -> 37563k
    Peak memory use before GGC: 19446k
    Peak memory use after GGC: 19245k
    Maximum of released memory in single GGC run: 2187k
    Garbage: 68818k -> 68818k
    Leak: 6681k
    Overhead: 7955k
    GGC runs: 406

comparing combine.c compilation at -O3 level:
    Overall memory needed: 45623k
    Peak memory use before GGC: 20560k
    Peak memory use after GGC: 19744k
    Maximum of released memory in single GGC run: 3125k
    Garbage: 102695k -> 102695k
    Leak: 6817k
    Overhead: 12395k
    GGC runs: 456

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 103547k
    Peak memory use before GGC: 69329k
    Peak memory use after GGC: 44976k
    Maximum of released memory in single GGC run: 36886k
    Garbage: 130571k
    Leak: 9588k
    Overhead: 16932k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 105067k
    Peak memory use before GGC: 70490k
    Peak memory use after GGC: 46244k
    Maximum of released memory in single GGC run: 36886k
    Garbage: 131730k
    Leak: 11278k
    Overhead: 17326k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 146167k -> 148183k
    Peak memory use before GGC: 86337k
    Peak memory use after GGC: 80543k
    Maximum of released memory in single GGC run: 33045k
    Garbage: 264605k
    Leak: 9404k
    Overhead: 27590k
    GGC runs: 225

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 191635k -> 191643k
    Peak memory use before GGC: 87648k
    Peak memory use after GGC: 80609k
    Maximum of released memory in single GGC run: 31388k
    Garbage: 299515k -> 299515k
    Leak: 9401k
    Overhead: 33192k
    GGC runs: 245

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 191655k -> 191659k
    Peak memory use before GGC: 87665k
    Peak memory use after GGC: 80626k
    Maximum of released memory in single GGC run: 31450k
    Garbage: 300153k -> 300153k
    Leak: 9407k
    Overhead: 33388k
    GGC runs: 245

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 151184k -> 151192k
    Peak memory use before GGC: 92317k
    Peak memory use after GGC: 91394k
    Maximum of released memory in single GGC run: 18793k
    Garbage: 210317k
    Leak: 49389k
    Overhead: 23720k
    GGC runs: 411

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 169352k
    Peak memory use before GGC: 104950k
    Peak memory use after GGC: 103910k
    Maximum of released memory in single GGC run: 18979k
    Garbage: 216936k
    Leak: 72814k
    Overhead: 29643k
    GGC runs: 382

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 145031k
    Peak memory use before GGC: 103088k
    Peak memory use after GGC: 102050k
    Maximum of released memory in single GGC run: 17981k
    Garbage: 392073k
    Leak: 50219k
    Overhead: 34383k
    GGC runs: 541

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 146127k
    Peak memory use before GGC: 103514k
    Peak memory use after GGC: 102485k
    Maximum of released memory in single GGC run: 17979k
    Garbage: 431219k -> 431219k
    Leak: 50909k
    Overhead: 39623k
    GGC runs: 592

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 148999k -> 148995k
    Peak memory use before GGC: 104781k
    Peak memory use after GGC: 103711k
    Maximum of released memory in single GGC run: 18300k
    Garbage: 450979k -> 450979k
    Leak: 51004k
    Overhead: 41437k
    GGC runs: 607

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
  Amount of memory still referenced at the end of compilation decreased from 8082k to 7570k, overall -6.76%
    Overall memory needed: 246990k -> 245794k
    Peak memory use before GGC: 82632k -> 81775k
    Peak memory use after GGC: 59514k
    Maximum of released memory in single GGC run: 45585k -> 44985k
    Garbage: 147214k -> 145986k
    Leak: 8082k -> 7570k
    Overhead: 24807k -> 24807k
    GGC runs: 80

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 247850k -> 246646k
    Peak memory use before GGC: 83278k -> 82421k
    Peak memory use after GGC: 60160k
    Maximum of released memory in single GGC run: 45230k -> 44974k
    Garbage: 147433k -> 146205k
    Leak: 9338k
    Overhead: 25303k -> 25303k
    GGC runs: 88 -> 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 258683k -> 258635k
    Peak memory use before GGC: 104513k -> 104509k
    Peak memory use after GGC: 101299k -> 101295k
    Maximum of released memory in single GGC run: 51827k -> 51835k
    Garbage: 240867k -> 240015k
    Leak: 25176k
    Overhead: 29476k -> 29476k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 531999k -> 531975k
    Peak memory use before GGC: 104503k
    Peak memory use after GGC: 101289k
    Maximum of released memory in single GGC run: 37171k -> 37167k
    Garbage: 272708k -> 270332k
    Leak: 25605k -> 25093k
    Overhead: 35515k -> 35313k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1181215k -> 1180679k
    Peak memory use before GGC: 200610k
    Peak memory use after GGC: 188951k
    Maximum of released memory in single GGC run: 80735k -> 80732k
    Garbage: 371820k -> 371298k
    Leak: 45260k
    Overhead: 48290k -> 48285k
    GGC runs: 70

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-02-09 04:41:43.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-02-09 20:27:14.000000000 +0000
@@ -1,3 +1,68 @@
+2007-02-09  Richard Henderson  <rth@redhat.com>
+
+	* config/i386/constraints.md (Ym): New constraint.
+	* config/i386/i386.md (movsi_1): Change Y2 to Yi constraints.
+	(movdi_1_rex64): Split sse and xmm general register moves from
+	memory move alternatives.  Use conditional register constraints.
+	(movsf_1, movdf_integer): Likewise.
+	(zero_extendsidi2_32, zero_extendsidi2_rex64): Likewise.
+	(movdf_integer_rex64): New.
+	(pushsf_rex64): Fix output constraints.
+	* config/i386/sse.md (sse2_loadld): Split rm alternative, use Yi.
+	(sse2_stored): Likewise.
+	(sse2_storeq_rex64): New.
+	* config/i386/i386.c (x86_inter_unit_moves): Enable for not
+	amd and not generic.
+	(ix86_secondary_memory_needed): Don't bypass TARGET_INTER_UNIT_MOVES
+	for optimize_size.  Remove SF/DFmode hack.
+
+2007-02-09  Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+
+        * config/i386/driver-i386.c: Turn on -mtune=native for AMDFAM10.
+        (bit_SSE4a): New.
+
+2007-02-09  Nathan Sidwell  <nathan@codesourcery.com>
+	    Richard Sandiford  <richard@codesourcery.com>
+
+	* config.gcc (m68010-*-netbsdelf*, m68k*-*-netbsdelf*)
+	(m68k*-*-openbsd*, m68k-*-linux*): Set default_cf_cpu.
+	(m68k-*-aout*, m68k-*-coff*, m68k-*-uclinux*, m68k-*-rtems*): Add
+	m68k/t-mlib to tmake_file.
+	(m68020-*-elf*, m68k-*-elf*): Likewise.  Add t-m68kbare as well.
+	(m68k*-*-*): Use --with-arch to pick a default for --with-cpu.
+	(m680[012]0-*-*, m68k*-*-*): Add support for --with-arch.
+	Allow it to be cf or m68k.  Set m68k_arch_family.  If that
+	variable is not empty, add t-$m68k_arch_family to tmake_file.
+	Add t-mlibs to tmake_file.
+	* doc/install.texi: Document --with-arch=m68k and --with-arch=cf.
+	* config/m68k/t-cf: New file.
+	* config/m68k/t-m68k: Likewise.
+	* config/m68k/t-mlibs: Likewise.
+	* config/m68k/t-m68kbare (MULTILIB_OPTIONS, MULTILIB_DIRNAMES)
+	(MULTILIB_MATCHES, MULTILIB_EXCEPTIONS): Delete.
+	(M68K_MLIB_DIRNAMES, M68K_MLIB_OPTIONS): Define.
+	* config/m68k/t-m68kelf (MULTILIB_OPTIONS, MULTILIB_DIRNAMES)
+	(MULTILIB_MATCHES, MULTILIB_EXCEPTIONS, LIBGCC, INSTALL_LIBGCC):
+	Delete.
+	* config/m68k/t-openbsd (MULTILIB_OPTIONS, LIBGCC): Delete.
+	(INSTALL_LIBGCC): Delete.
+	(M68K_MLIB_DIRNAMES, M68K_MLIB_OPTIONS): Define.
+	* config/m68k/t-rtems (MULTILIB_OPTIONS, MULTILIB_DIRNAMES)
+	(MULTILIB_MATCHES, MULTILIB_EXCEPTIONS): Delete.
+	(M68K_MLIB_CPU): Define.
+	* config/m68k/t-uclinux (MULTILIB_OPTIONS, MULTILIB_DIRNAMES)
+	(MULTILIB_MATCHES, MULTILIB_EXCEPTIONS): Delete.
+	(M68K_MLIB_CPU, M68K_MLIB_OPTIONS, M68K_MLIB_DIRNAMES): Define.
+
+2007-02-09  Zdenek Dvorak  <dvorakz@suse.cz>
+	Richard Guenther  <rguenther@suse.de>
+
+	PR middle-end/23361
+	* fold-const.c (fold_comparison): Handle obfuscated comparisons
+	against INT_MIN/INT_MAX.
+	* tree-ssa-loop-ivcanon.c (remove_empty_loop): Print to dump
+	file if a loop is removed.
+
 2007-02-09  Joseph Myers  <joseph@codesourcery.com>
 
 	* calls.c (store_one_arg): Pass correct alignment to


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