A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Wed Feb 14 13:59: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: 7381k
    Peak memory use before GGC: 2268k
    Peak memory use after GGC: 1957k
    Maximum of released memory in single GGC run: 311k
    Garbage: 446k
    Leak: 2291k
    Overhead: 456k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7397k
    Peak memory use before GGC: 2296k
    Peak memory use after GGC: 1985k
    Maximum of released memory in single GGC run: 311k
    Garbage: 449k
    Leak: 2324k
    Overhead: 461k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 7513k
    Peak memory use before GGC: 2268k
    Peak memory use after GGC: 1957k
    Maximum of released memory in single GGC run: 311k
    Garbage: 452k
    Leak: 2294k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 7513k
    Peak memory use before GGC: 2269k
    Peak memory use after GGC: 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2294k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7513k
    Peak memory use before GGC: 2269k
    Peak memory use after GGC: 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2294k
    Overhead: 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17785k -> 17789k
    Peak memory use before GGC: 9294k
    Peak memory use after GGC: 8873k
    Maximum of released memory in single GGC run: 2603k
    Garbage: 37160k
    Leak: 6541k
    Overhead: 5024k
    GGC runs: 280

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19821k
    Peak memory use before GGC: 10899k
    Peak memory use after GGC: 10533k
    Maximum of released memory in single GGC run: 2375k
    Garbage: 37749k
    Leak: 9418k
    Overhead: 5727k
    GGC runs: 270

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35169k -> 35173k
    Peak memory use before GGC: 19438k
    Peak memory use after GGC: 19223k
    Maximum of released memory in single GGC run: 2197k
    Garbage: 57474k
    Leak: 6567k
    Overhead: 6356k
    GGC runs: 352

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37501k -> 37505k
    Peak memory use before GGC: 19472k
    Peak memory use after GGC: 19271k
    Maximum of released memory in single GGC run: 2184k
    Garbage: 68714k
    Leak: 6676k
    Overhead: 7979k
    GGC runs: 403

comparing combine.c compilation at -O3 level:
    Overall memory needed: 45729k
    Peak memory use before GGC: 20505k
    Peak memory use after GGC: 19623k
    Maximum of released memory in single GGC run: 3160k
    Garbage: 101101k
    Leak: 6816k
    Overhead: 12209k
    GGC runs: 452

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 103545k
    Peak memory use before GGC: 69332k
    Peak memory use after GGC: 44978k
    Maximum of released memory in single GGC run: 36886k
    Garbage: 130575k
    Leak: 9591k
    Overhead: 16932k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 105077k -> 105073k
    Peak memory use before GGC: 70493k
    Peak memory use after GGC: 46246k
    Maximum of released memory in single GGC run: 36887k
    Garbage: 131985k
    Leak: 11026k
    Overhead: 17326k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 148013k -> 148009k
    Peak memory use before GGC: 86339k
    Peak memory use after GGC: 80546k
    Maximum of released memory in single GGC run: 33057k
    Garbage: 264735k
    Leak: 9407k
    Overhead: 27615k
    GGC runs: 225

comparing insn-attrtab.c compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 191409k to 196317k, overall 2.56%
    Overall memory needed: 191409k -> 196317k
    Peak memory use before GGC: 87655k
    Peak memory use after GGC: 80616k
    Maximum of released memory in single GGC run: 31415k
    Garbage: 299495k
    Leak: 9404k
    Overhead: 33192k
    GGC runs: 245

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 191537k -> 191545k
    Peak memory use before GGC: 87668k
    Peak memory use after GGC: 80629k
    Maximum of released memory in single GGC run: 31478k
    Garbage: 300161k
    Leak: 9409k
    Overhead: 33393k
    GGC runs: 245

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 151175k -> 151208k
    Peak memory use before GGC: 92319k
    Peak memory use after GGC: 91396k
    Maximum of released memory in single GGC run: 18792k
    Garbage: 209348k
    Leak: 49388k
    Overhead: 23612k
    GGC runs: 410

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 169331k -> 169344k
    Peak memory use before GGC: 104952k
    Peak memory use after GGC: 103913k
    Maximum of released memory in single GGC run: 18978k
    Garbage: 215949k
    Leak: 72813k
    Overhead: 29533k
    GGC runs: 381

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 142180k -> 142181k
    Peak memory use before GGC: 102382k
    Peak memory use after GGC: 101354k
    Maximum of released memory in single GGC run: 17982k
    Garbage: 345994k
    Leak: 50047k
    Overhead: 30171k
    GGC runs: 522

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 142792k -> 142793k
    Peak memory use before GGC: 103057k
    Peak memory use after GGC: 101996k
    Maximum of released memory in single GGC run: 17979k
    Garbage: 374823k
    Leak: 50652k
    Overhead: 34098k
    GGC runs: 558

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 145952k -> 145949k
    Peak memory use before GGC: 104821k
    Peak memory use after GGC: 103752k
    Maximum of released memory in single GGC run: 18300k
    Garbage: 392083k
    Leak: 51305k
    Overhead: 35435k
    GGC runs: 569

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 245805k -> 245800k
    Peak memory use before GGC: 81778k
    Peak memory use after GGC: 59517k
    Maximum of released memory in single GGC run: 44985k
    Garbage: 145987k
    Leak: 7572k
    Overhead: 24807k
    GGC runs: 80

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 246657k -> 246660k
    Peak memory use before GGC: 82424k
    Peak memory use after GGC: 60163k
    Maximum of released memory in single GGC run: 44975k
    Garbage: 146205k
    Leak: 9340k
    Overhead: 25303k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 240801k -> 240681k
    Peak memory use before GGC: 84342k
    Peak memory use after GGC: 73896k
    Maximum of released memory in single GGC run: 36499k
    Garbage: 224355k
    Leak: 19610k
    Overhead: 30452k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 486217k -> 486097k
    Peak memory use before GGC: 78746k
    Peak memory use after GGC: 73896k
    Maximum of released memory in single GGC run: 33796k
    Garbage: 231751k
    Leak: 19700k
    Overhead: 32593k
    GGC runs: 92

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1180829k -> 1180297k
    Peak memory use before GGC: 200612k
    Peak memory use after GGC: 188954k
    Maximum of released memory in single GGC run: 80737k
    Garbage: 376511k
    Leak: 45254k
    Overhead: 49197k
    GGC runs: 70

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-02-13 20:00:41.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-02-14 11:59:21.000000000 +0000
@@ -1,3 +1,118 @@
+2007-02-14  Nick Clifton  <nickc@redhat.com>
+
+	* builtin-types.def (DEF_FUNCTION_TYPE_x): Do not imply that at
+	most 3 arguments are supported.
+	(DEF_FUNCTION_TYPE_VAR_5): Fix typo in its description.
+
+2007-02-13  Seongbae Park <seongbae.park@gmail.com>
+
+       * bitmap.c (bitmap_and, bitmap_and_compl, bitmap_xor):
+       Ensure dst->current is valid.
+
+2007-02-13  Paul Brook  <paul@codesourcery.com>
+
+	* config.gcc: Add arm*-*-uclinux-*eabi.
+	* config/arm/uclinux-elf.h (TARGET_OS_CPP_BUILTINS): Define.
+	(SUBTARGET_EXTRA_LINK_SPEC): Define.
+	(STARTFILE_SPEC, ENDFILE_SPEC): Remove broken -shared handling.
+	(LINK_GCC_C_SEQUENCE_SPEC): Undef.
+	(LINK_SPEC): Define.
+	(LIB_SPEC): Define.
+	* config/arm/arm.c (arm_override_options): Use r9 as EABI PIC
+	register.
+	* config/arm/uclinux-eabi.h: New file.
+	* config/arm/linux-eabi.h (WCHAR_TYPE): Remove.
+	* config/arm/linux-gas.h (WCHAR_TYPE): Use unsigned long on AAPCS
+	based targets.
+
+2007-02-13  Ian Lance Taylor  <iant@google.com>
+
+	* common.opt: Add Wstrict-overflow and Wstrict-overflow=.
+	* flags.h (warn_strict_overflow): Declare.
+	(enum warn_strict_overflow_code): Define.
+	(issue_strict_overflow_warning): New static inline function.
+	* opts.c (warn_strict_overflow): New variable.
+	(common_handle_option): Handle OPT_Wstrict_overflow and
+	OPT_Wstrict_overflow_.
+	* c-opts.c (c_common_handle_option): Set warn_strict_overflow for
+	OPT_Wall.
+	* fold-const.c: Include intl.h.
+	(fold_deferring_overflow_warnings): New static variable.
+	(fold_deferred_overflow_warning): New static variable.
+	(fold_deferred_overflow_code): New static variable.
+	(fold_defer_overflow_warnings): New function.
+	(fold_undefer_overflow_warnings): New function.
+	(fold_undefer_and_ignore_overflow_warnings): New function.
+	(fold_deferring_overflow_warnings_p): New function.
+	(fold_overflow_warning): New static function.
+	(make_range): Add strict_overflow_p parameter.  Change all
+	callers.
+	(extract_muldiv, extract_muldiv_1): Likewise.
+	(fold_unary) [ABS_EXPR]: Check ABS_EXPR before calling
+	tree_expr_nonnegative_p.
+	(fold_negate_expr): Call fold_overflow_warning.
+	(fold_range_test): Likewise.
+	(fold_comparison): Likewise.
+	(fold_binary): Likewise.  Call tree_expr_nonnegative_warnv_p
+	instead of tree_expr_nonnegative_p.
+	(tree_expr_nonnegative_warnv_p): Rename from
+	tree_expr_nonnegative_p, add strict_overflow_p parameter.
+	(tree_expr_nonnegative_p): New function.
+	(tree_expr_nonzero_warnv_p): Rename from tree_expr_nonzero_p, add
+	strict_overflow_p parameter.
+	(tree_expr_nonzero_p): New function.
+	* passes.c (verify_interpass_invariants): New static function.
+	(execute_one_pass): Call it.
+	* tree-ssa-loop-niter.c (expand_simple_operations): Ignore fold
+	warnings.
+	(number_of_iterations_exit, loop_niter_by_eval): Likewise.
+	(estimate_numbers_of_iterations): Likewise.
+	(scev_probably_wraps_p): Likewise.
+	* tree-ssa-ccp.c: Include "toplev.h".
+	(evaluate_stmt): Defer fold overflow warnings until we know we are
+	going to optimize.
+	(struct fold_stmt_r_data): Add stmt field.
+	(fold_stmt_r): Defer fold overflow warnings until we know we
+	optimized.
+	(fold_stmt): Initialize stmt field of fold_stmt_r_data.
+	(fold_stmt_inplace): Likewise.
+	* tree-cfgcleanup.c: Include "toplev.h" rather than "errors.h".
+	(cleanup_control_expr_graph): Defer fold overflow warnings until
+	we know we are going to optimize.
+	* tree-cfg.c (fold_cond_expr_cond): Likewise.
+	* tree-ssa-threadedge.c (simplify_control_stmt_condition):
+	Likewise.
+	* tree-vrp.c (vrp_expr_computes_nonnegative): Call
+	tree_expr_nonnegative_warnv_p instead of tree_expr_nonnegative_p.
+	* tree-ssa-loop-manip.c (create_iv): Likewise.
+	* c-typeck.c (build_conditional_expr): Likewise.
+	(build_binary_op): Likewise.
+	* tree-vrp.c (vrp_expr_computes_nonzero): Call
+	tree_expr_nonzero_warnv_p instead of tree_expr_nonzero_p.
+	(extract_range_from_unary_expr): Likewise.
+	* simplify-rtx.c (simplify_const_relational_operation): Warn when
+	assuming that signed overflow does not occur.
+	* c-common.c (pointer_int_sum): Ignore fold overflow warnings.
+	* tree.h (tree_expr_nonnegative_warnv_p): Declare.
+	(fold_defer_overflow_warnings): Declare.
+	(fold_undefer_overflow_warnings): Declare.
+	(fold_undefer_and_ignore_overflow_warnings): Declare.
+	(fold_deferring_overflow_warnings_p): Declare.
+	(tree_expr_nonzero_warnv_p): Declare.
+	* doc/invoke.texi (Option Summary): Add -Wstrict-overflow to list
+	of warning options.
+	(Warning Options): Document -Wstrict-overflow.
+	* Makefile.in (tree-ssa-threadedge.o): Depend on toplev.h.
+	(tree-ssa-ccp.o): Likewise.
+	(tree-cfgcleanup.o): Change errors.h dependency to toplev.h.
+	(fold-const.o): Depend on intl.h.
+
+2007-02-13  Ian Lance Taylor  <iant@google.com>
+
+	PR middle-end/30751
+	* lower-subreg.c (resolve_simple_move): Decompose subregs in
+	addresses.
+
 2007-02-13  Stuart Hastings  <stuart@apple.com>
 
 	* gcc/config/i386/i386.md (fixuns_truncdfhi2): Require SSE2.


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