This is the mail archive of the gcc-regression@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A recent patch increased GCC's memory consumption!


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: 3393k -> 3394k
    Peak memory use after GGC: 3040k -> 3042k
    Maximum of released memory in single GGC run: 353k -> 352k
    Garbage: 525k
    Leak: 3794k -> 3797k
    Overhead: 914k -> 915k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 8347k
    Peak memory use before GGC: 3420k -> 3422k
    Peak memory use after GGC: 3068k -> 3069k
    Maximum of released memory in single GGC run: 352k -> 353k
    Garbage: 527k
    Leak: 3827k -> 3829k
    Overhead: 918k -> 919k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 8387k
    Peak memory use before GGC: 3393k -> 3394k
    Peak memory use after GGC: 3040k -> 3042k
    Maximum of released memory in single GGC run: 353k -> 352k
    Garbage: 527k
    Leak: 3795k -> 3797k
    Overhead: 914k -> 915k
    GGC runs: 3

comparing empty function compilation at -O2 level:
    Overall memory needed: 8391k
    Peak memory use before GGC: 3393k -> 3395k
    Peak memory use after GGC: 3041k -> 3042k
    Maximum of released memory in single GGC run: 352k -> 353k
    Garbage: 531k
    Leak: 3796k -> 3798k
    Overhead: 915k -> 916k
    GGC runs: 3

comparing empty function compilation at -O3 level:
    Overall memory needed: 8391k
    Peak memory use before GGC: 3393k -> 3395k
    Peak memory use after GGC: 3041k -> 3042k
    Maximum of released memory in single GGC run: 352k -> 353k
    Garbage: 531k
    Leak: 3796k -> 3798k
    Overhead: 915k -> 916k
    GGC runs: 3

comparing combine.c compilation at -O0 level:
    Overall memory needed: 23747k -> 23751k
    Peak memory use before GGC: 10320k -> 10321k
    Peak memory use after GGC: 9564k -> 9565k
    Maximum of released memory in single GGC run: 1903k -> 1902k
    Garbage: 39074k -> 39098k
    Leak: 8852k -> 8847k
    Overhead: 5785k -> 5786k
    GGC runs: 254

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 25619k -> 25623k
    Peak memory use before GGC: 11981k -> 11982k
    Peak memory use after GGC: 11356k -> 11357k
    Maximum of released memory in single GGC run: 1515k -> 1516k
    Garbage: 39436k -> 39442k
    Leak: 11746k -> 11748k
    Overhead: 6490k -> 6491k
    GGC runs: 250

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35703k -> 35715k
    Peak memory use before GGC: 18981k -> 18983k
    Peak memory use after GGC: 18791k -> 18793k
    Maximum of released memory in single GGC run: 1375k
    Garbage: 52572k -> 52572k
    Leak: 8991k -> 8993k
    Overhead: 6746k -> 6747k
    GGC runs: 321

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37667k -> 37679k
    Peak memory use before GGC: 19035k -> 19037k
    Peak memory use after GGC: 18845k -> 18847k
    Maximum of released memory in single GGC run: 1410k -> 1409k
    Garbage: 70971k -> 70961k
    Leak: 9318k -> 9320k
    Overhead: 8862k -> 8862k
    GGC runs: 383

comparing combine.c compilation at -O3 level:
  Amount of memory still referenced at the end of compilation increased from 9430k to 9441k, overall 0.11%
    Overall memory needed: 40587k -> 40595k
    Peak memory use before GGC: 19310k -> 19311k
    Peak memory use after GGC: 18962k -> 18964k
    Maximum of released memory in single GGC run: 2261k -> 2262k
    Garbage: 92904k -> 92914k
    Leak: 9430k -> 9441k
    Overhead: 11490k -> 11491k
    GGC runs: 412

comparing insn-attrtab.c compilation at -O0 level:
  Amount of memory still referenced at the end of compilation increased from 11328k to 11585k, overall 2.26%
    Overall memory needed: 140095k -> 140099k
    Peak memory use before GGC: 60577k -> 60579k
    Peak memory use after GGC: 34071k -> 34072k
    Maximum of released memory in single GGC run: 34143k -> 34144k
    Garbage: 132271k -> 132014k
    Leak: 11328k -> 11585k
    Overhead: 15587k -> 15588k
    GGC runs: 197

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 141355k -> 141351k
    Peak memory use before GGC: 61739k -> 61741k
    Peak memory use after GGC: 35232k -> 35233k
    Maximum of released memory in single GGC run: 34144k -> 34145k
    Garbage: 132245k -> 132242k
    Leak: 13291k -> 13293k
    Overhead: 15985k -> 15986k
    GGC runs: 199

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 150255k -> 150223k
    Peak memory use before GGC: 59098k -> 59100k
    Peak memory use after GGC: 52847k -> 52849k
    Maximum of released memory in single GGC run: 24232k
    Garbage: 212964k -> 212964k
    Leak: 12476k -> 12479k
    Overhead: 25581k -> 25582k
    GGC runs: 222

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 188931k -> 188919k
    Peak memory use before GGC: 59720k -> 59722k
    Peak memory use after GGC: 54426k -> 54428k
    Maximum of released memory in single GGC run: 22887k
    Garbage: 254073k -> 254073k
    Leak: 13558k -> 13560k
    Overhead: 31304k -> 31305k
    GGC runs: 249

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 195903k -> 195879k
    Peak memory use before GGC: 71703k -> 71706k
    Peak memory use after GGC: 65136k -> 65139k
    Maximum of released memory in single GGC run: 23330k -> 23329k
    Garbage: 281242k -> 281239k
    Leak: 13569k -> 13571k
    Overhead: 33103k -> 33104k
    GGC runs: 252

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 156624k -> 156546k
    Peak memory use before GGC: 91647k -> 91648k
    Peak memory use after GGC: 90730k -> 90731k
    Maximum of released memory in single GGC run: 17994k
    Garbage: 210889k -> 210888k
    Leak: 55686k -> 55688k
    Overhead: 27055k -> 27056k
    GGC runs: 397

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 177780k -> 177382k
    Peak memory use before GGC: 104615k -> 104616k
    Peak memory use after GGC: 103571k -> 103572k
    Maximum of released memory in single GGC run: 18709k
    Garbage: 216744k -> 216740k
    Leak: 79114k -> 79116k
    Overhead: 33023k -> 33024k
    GGC runs: 373

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 133412k -> 133443k
    Peak memory use before GGC: 93613k -> 93614k
    Peak memory use after GGC: 92686k -> 92687k
    Maximum of released memory in single GGC run: 17378k
    Garbage: 318246k -> 318245k
    Leak: 55572k -> 55574k
    Overhead: 32816k -> 32818k
    GGC runs: 498

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 141728k -> 141771k
    Peak memory use before GGC: 94126k
    Peak memory use after GGC: 93189k -> 93190k
    Maximum of released memory in single GGC run: 17378k
    Garbage: 375366k -> 375367k
    Leak: 56793k -> 56795k
    Overhead: 39164k -> 39165k
    GGC runs: 559 -> 558

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 145148k -> 145139k
    Peak memory use before GGC: 95151k -> 95153k
    Peak memory use after GGC: 94067k -> 94068k
    Maximum of released memory in single GGC run: 17793k
    Garbage: 415735k -> 415739k
    Leak: 57192k -> 57194k
    Overhead: 42425k -> 42426k
    GGC runs: 587

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 381015k -> 381009k
    Peak memory use before GGC: 103474k -> 103475k
    Peak memory use after GGC: 59127k -> 59129k
    Maximum of released memory in single GGC run: 50583k -> 50582k
    Garbage: 179674k
    Leak: 9006k -> 9009k
    Overhead: 31653k -> 31654k
    GGC runs: 65

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 381827k -> 381829k
    Peak memory use before GGC: 104120k -> 104121k
    Peak memory use after GGC: 59774k -> 59775k
    Maximum of released memory in single GGC run: 50582k
    Garbage: 179778k -> 179835k
    Leak: 10775k -> 10777k
    Overhead: 32149k -> 32150k
    GGC runs: 72

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 290247k -> 289991k
    Peak memory use before GGC: 82781k -> 82783k
    Peak memory use after GGC: 75169k -> 75171k
    Maximum of released memory in single GGC run: 40017k -> 40018k
    Garbage: 236071k -> 236071k
    Leak: 18345k -> 18347k
    Overhead: 32718k -> 32719k
    GGC runs: 70 -> 69

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 277471k -> 277755k
    Peak memory use before GGC: 80156k -> 80157k
    Peak memory use after GGC: 75170k -> 75171k
    Maximum of released memory in single GGC run: 33750k -> 33751k
    Garbage: 246134k -> 246134k
    Leak: 18433k -> 18436k
    Overhead: 34944k -> 34945k
    GGC runs: 83 -> 82

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1012339k -> 1012807k
    Peak memory use before GGC: 168797k -> 168799k
    Peak memory use after GGC: 158361k -> 158363k
    Maximum of released memory in single GGC run: 83495k
    Garbage: 356480k -> 356480k
    Leak: 28508k -> 28510k
    Overhead: 46898k -> 46899k
    GGC runs: 66 -> 65

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-08-20 18:17:16.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-08-21 01:28:33.000000000 +0000
@@ -1,3 +1,67 @@
+2007-08-20  Chao-ying Fu  <fu@mips.com>
+
+	* c-common.h (enum rid): Add new enumeration values of RID_SAT,
+	RID_FRACT, and RID_ACCUM.  RID_SAT needs to be inserted before
+	RID_ONEWAY, so that it can be checked in declspecs_add_type.
+	(c_common_fixed_point_type_for_size): Declare.
+	* c-parser.c (reswords): Add _Fract, _Accum, and _Sat.
+	(c_token_starts_typename): Handle RID_FRACT, RID_ACCUM, and RID_SAT.
+	(c_token_starts_declspecs): Likewise.
+	(c_parser_declspecs): Likewise.
+	(c_parser_attributes): Likewise.
+	* c-tree.h (enum c_typespec_keyword): Add cts_fract and cts_accum.
+	(c_declspecs): Add saturating_p.
+	* c-decl.c (build_null_declspecs): Initialize saturating_p.
+	(declspecs_add_type): Avoid using complex with _Fract, _Accum, or _Sat.
+	Handle RID_SAT.
+	Avoid using void, bool, char, int, float, double, _Decimal32,
+	_Decimal64, _Decimal128, and complex with _Sat.
+	Handle RID_FRACT and RID_ACCUM.
+	Make sure _Sat is used with _Fract or _Accum.
+	(finish_declspecs): Handle cts_fract and cts_accum.
+	* c-common.c (fixed-value.h): New include.
+	(constant_expression_warning): Handle FIXED_CST.
+	(overflow_warning): Likewise.
+	(warnings_for_convert_and_check): Likewise.
+	(c_common_fixed_point_type_for_size): New.
+	(c_common_type_for_mode): Handle fixed-point modes to
+	return various saturating/non-saturating, signed/unsigned types.
+	(c_common_signed_or_unsigned_type): Support fixed-point types.
+	(shorten_compare): Check fixed-point zero.
+	Handle FIXED_POINT_TYPE.
+	(c_common_truthvalue_conversion): Handle FIXED_CST.
+	Handle FIXED_POINT_TYPE.
+	(c_common_nodes_and_builtins): Record builtin types for fixed-point
+	types.
+	(handle_mode_attribute): Handle fixed-point modes.  Need to check
+	if the signness of base type and fixed-point modes are consistent.
+	(handle_vector_size_attribute): Handle fixed-point modes.
+	(same_scalar_type_ignoring_signedness): Handle FIXED_POINT_TYPE.
+	(warn_for_div_by_zero): Check fixed-point zero.
+	* c-typeck.c (c_common_type): Check FIXED_POINT_TYPE.  Build
+	a common fixed-point type based on fbit, ibit, sign, and saturation.
+	(build_unary_op): Allow FIXED_POINT_TYPE for CONVERT_EXPR,
+	NEGATE_EXPR, TRUTH_NOT_EXPR, PREINCREMENT_EXPR, POSTINCREMENT_EXPR,
+	PREDECREMENT_EXPR, and POSTDECREMENT_EXPR.
+	(convert_for_assignment): Support FIXED_POINT_TYPE.
+	(digest_init): Handle FIXED_POINT_TYPE.
+	(build_binary_op): Support FIXED_POINT_TYPE in *_DIV_EXPR,
+	TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, TRUTH_AND_EXPR, TRUTH_OR_EXPR,
+	TRUTH_XOR_EXPR, RSHIFT_EXPR, LSHIFT_EXPR, EQ_EXPR, NE_EXPR, LE_EXPR,
+	GE_EXPR, LT_EXPR, GT_EXPR.
+	* target-def.h (TARGET_FIXED_POINT_SUPPORTED_P): New.
+	(TARGET_INITIALIZER): Add TARGET_FIXED_POINT_SUPPORTED_P.
+	* target.h (gcc_target): Add fixed_point_supported_p.
+	* targhooks.c (default_scalar_mode_supported_p): Handle MODE_FRACT,
+	MODE_UFRACT, MODE_ACCUM, and MODE_UACCUM.
+	(default_fixed_point_supported_p): Define.
+	* targhooks.h (default_fixed_point_supported_p): Declare.
+	* doc/tm.texi (TARGET_FIXED_POINT_SUPPORTED_P): Add.
+	* doc/install.texi (Configuration): Add --enable-fixed-point.
+	* configure.ac (--enable-fixed-point): New to enable fixed-point
+	arithmetic extension to C.  For mips targets, we enable it by default.
+	* configure, config.in: Regenerate.
+
 2007-08-20  Pawel Sikora  <pluto@pld-linux.org>
 
         * doc/invoke.texi (-Wnon-virtual-dtor): Update documentation.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]