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 combine.c compilation at -O0 level:
  Amount of memory still referenced at the end of compilation increased from 6696k to 6712k, overall 0.24%
    Overall memory needed: 24637k -> 24769k
    Peak memory use before GGC: 9586k
    Peak memory use after GGC: 8934k
    Maximum of released memory in single GGC run: 2754k
    Garbage: 41358k -> 41357k
    Leak: 6696k -> 6712k
    Overhead: 5818k -> 5818k
    GGC runs: 321

comparing combine.c compilation at -O1 level:
    Overall memory needed: 26808k
    Peak memory use before GGC: 17359k
    Peak memory use after GGC: 17170k
    Maximum of released memory in single GGC run: 2402k -> 2401k
    Garbage: 66308k -> 66313k
    Leak: 7186k -> 7186k
    Overhead: 7737k -> 7737k
    GGC runs: 415

comparing combine.c compilation at -O2 level:
    Overall memory needed: 26808k
    Peak memory use before GGC: 17360k
    Peak memory use after GGC: 17170k
    Maximum of released memory in single GGC run: 2503k
    Garbage: 84750k -> 84752k
    Leak: 7426k -> 7426k
    Overhead: 10298k -> 10298k
    GGC runs: 482

comparing combine.c compilation at -O3 level:
    Overall memory needed: 26808k
    Peak memory use before GGC: 17609k
    Peak memory use after GGC: 17170k
    Maximum of released memory in single GGC run: 3332k
    Garbage: 115642k -> 115658k
    Leak: 7496k -> 7496k
    Overhead: 13503k -> 13503k
    GGC runs: 534 -> 533

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 81640k
    Peak memory use before GGC: 70259k
    Peak memory use after GGC: 44999k
    Maximum of released memory in single GGC run: 37046k
    Garbage: 149918k -> 149921k
    Leak: 11332k -> 11038k
    Overhead: 19106k -> 19859k
    GGC runs: 254 -> 255

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 114504k -> 113400k
    Peak memory use before GGC: 96260k -> 95572k
    Peak memory use after GGC: 85581k -> 84893k
    Maximum of released memory in single GGC run: 32777k
    Garbage: 295377k -> 295368k
    Leak: 11556k -> 11261k
    Overhead: 36053k -> 36806k
    GGC runs: 251 -> 252

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 125220k -> 124520k
    Peak memory use before GGC: 115308k -> 114614k
    Peak memory use after GGC: 85547k -> 84853k
    Maximum of released memory in single GGC run: 32461k
    Garbage: 381553k -> 381547k
    Leak: 11670k -> 11374k
    Overhead: 47864k -> 48613k
    GGC runs: 280 -> 281

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 125236k -> 124540k
    Peak memory use before GGC: 115333k -> 114639k
    Peak memory use after GGC: 85572k -> 84878k
    Maximum of released memory in single GGC run: 32774k
    Garbage: 382072k -> 382063k
    Leak: 11686k -> 11391k
    Overhead: 47917k -> 48666k
    GGC runs: 282 -> 284

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 118644k -> 118616k
    Peak memory use before GGC: 95352k -> 95312k
    Peak memory use after GGC: 94399k -> 94369k
    Maximum of released memory in single GGC run: 20182k -> 20154k
    Garbage: 224270k -> 224302k
    Leak: 49424k -> 49416k
    Overhead: 36949k -> 36958k
    GGC runs: 340 -> 341

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 106152k -> 105600k
    Peak memory use before GGC: 94846k -> 94268k
    Peak memory use after GGC: 93895k -> 93333k
    Maximum of released memory in single GGC run: 19798k -> 19336k
    Garbage: 597228k -> 597248k
    Leak: 55691k -> 55683k
    Overhead: 69420k -> 69437k
    GGC runs: 520

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 106160k -> 105612k
    Peak memory use before GGC: 94846k -> 94269k
    Peak memory use after GGC: 93896k -> 93333k
    Maximum of released memory in single GGC run: 19798k -> 19336k
    Garbage: 680043k -> 680026k
    Leak: 56612k -> 56604k
    Overhead: 80671k -> 80707k
    GGC runs: 584 -> 585

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 108480k -> 108428k
    Peak memory use before GGC: 95607k -> 95586k
    Peak memory use after GGC: 94659k -> 94639k
    Maximum of released memory in single GGC run: 19697k -> 19693k
    Garbage: 726105k -> 726122k
    Leak: 56844k -> 56836k
    Overhead: 84331k -> 84348k
    GGC runs: 591

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2005-07-19 20:49:39.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2005-07-20 06:13:24.000000000 +0000
@@ -1,3 +1,101 @@
+2005-07-20  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+	* config/sh/sh.c (regno_reg_class): Add GENERAL_REGS for
+	soft frame pointer.
+	(sh_expand_prologue): Use hard_frame_pointer_rtx instead
+	of frame_pointer_rtx.
+	(sh_expand_epilogue): Likewise.
+	(sh_set_return_address): Likewise.
+	(initial_elimination_offset): Use HARD_FRAME_POINTER_REGNUM
+	instead of FRAME_POINTER_REGNUM if needed.  Add elimination
+	offsets from FRAME_POINTER_REGNUM.
+	* config/sh/sh.h (SH_REGISTER_NAMES_INITIALIZER): Add sfp.
+	(sh_register_names): Add initializer for sfp.
+	(GENERAL_OR_AP_REGISTER_P): Permit FRAME_POINTER_REGNUM.
+	(VALID_REGISTER_P): Likewise.
+	(FIRST_PSEUDO_REGISTER): Update.
+	(DWARF_FRAME_REGISTERS): Define.
+	(FIXED_REGISTERS, CALL_USED_REGISTERS): Add sfp.
+	(HARD_FRAME_POINTER_REGNUM): Define.
+	(FRAME_POINTER_REGNUM): Redefine.
+	(ELIMINABLE_REGS): Never eliminate to FRAME_POINTER_REGNUM,
+	but HARD_FRAME_POINTER_REGNUM instead.  Add eliminations
+	from FRAME_POINTER_REGNUM.
+	(CAN_ELIMINATE): Use HARD_FRAME_POINTER_REGNUM instead of
+	FRAME_POINTER_REGNUM.
+	(REG_CLASS_CONTENTS): Add sfp.
+	(REG_ALLOC_ORDER): Likewise.
+	(FRAME_GROWS_DOWNWARD): Set to 1.  Update comment.
+	(GO_IF_LEGITIMATE_ADDRESS): Use hard_frame_pointer_rtx instead
+	of frame_pointer_rtx.
+	(LEGITIMIZE_RELOAD_ADDRESS): Likewise.
+
+2005-07-19  James A. Morrison  <phython@gcc.gnu.org>
+
+	* fold-const.c (tree_expr_nonnegative_p): Only return true for
+	ABS_EXPR when flag_wrapv is false because of INT_MIN.
+	(tree_expr_nonzero_p): Always call tree_expr_nonzero_p on the argument
+	of an ABS_EXPR.
+	(fold_unary): Always fold ABS_EXPR<ABS_EXPR<x>> into
+	ABS_EXPR<x>.
+
+2005-07-20  Giovanni Bajo  <giovannibajo@libero.it>
+
+	Make CONSTRUCTOR use VEC to store initializers.
+	* c-common.c (complete_array_type): Update to cope with VEC in
+	CONSTRUCTOR_ELTS.
+	* c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts.
+	(pp_c_constructor_elts): New function.
+	* c-pretty-print.h (pp_c_constructor_elts): Declare.
+	* c-typeck.c (build_function_call, build_c_cast, digest_init,
+	struct constructor_stack, struct initializer_stack,
+	constructor_elements, push_init_level, pop_init_level,
+	add_pending_init, find_init_member, output_init_element): Update to
+	cope with VEC in CONSTRUCTOR_ELTS.
+	* coverage.c (build_fn_info_value, build_ctr_info_value,
+	build_gcov_info): Likewise.
+	* expr.c (categorize_ctor_elements_1, store_constructor,
+	expand_expr_real_1): Likewise.
+	* fold-const.c (fold_ternary): Likewise.
+	* gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl,
+	gimplify_init_constructor, gimplify_expr): Likewise.
+	* tree-dump.c (dequeue_and_dump): Likewise.
+	* tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR
+	node.
+	* tree-pretty-print.c (dump_generic_node): Update to cope with VEC in
+	CONSTRUCTOR_ELTS.
+	* tree-sra.c (generate_element_init_1): Likewise.
+	* tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise.
+	* tree-ssa-operands.c (get_expr_operands): Likewise.
+	* tree-vect-generic.c (expand_vector_piecewise): Likewise.
+	* tree-vect-transform.c (vect_get_vec_def_for_operand):
+	(get_initial_def_for_reduction): Likewise.
+	* tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses
+	value handle in annotations.
+	* tree.c (tree_node_kind, tree_code_size, make_node_stat,
+	tree_node_structure): Add support for constr_kind.
+	(build_vector_from_ctor, build_constructor_single,
+	build_constructor_from_list): New functions.
+	(build_constructor): Update to take a VEC instead of a TREE_LIST.
+	(simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree):
+	Update to cope with VEC in CONSTRUCTOR_ELTS.
+	* tree.def (CONSTRUCTOR): Make it a tcc_exceptional node.
+	* tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT,
+	CONSTRUCTOR_APPEND_ELT): New macros.
+	(struct constructor_elt, struct	tree_constructor): New data types.
+	(union tree_node): Add tree_constructor field.
+	* treestruct.def: Define TS_CONSTRUCTOR.
+	* varasm.c (const_hash_1, compare_constant, copy_constant,
+	compute_reloc_for_constant, output_addressed_constants,
+	initializer_constant_valid_p, output_constant,
+	array_size_for_constructor, output_constructor): Update to cope with
+	VEC in CONSTRUCTOR_ELTS.
+	* vec.h (VEC_empty, VEC_copy): New macros.
+
+2005-07-19  Devang Patel  <dpatel@apple.com>
+
+	* dbxout.c (dbxout_type): Check Objective-C++ lang.
+	
 2005-07-19  Richard Henderson  <rth@redhat.com>
 
 	PR tree-opt/22278
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2005-07-18 16:08:51.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2005-07-20 06:13:31.000000000 +0000
@@ -1,3 +1,54 @@
+2005-07-20  Giovanni Bajo  <giovannibajo@libero.it>
+
+	Make CONSTRUCTOR use VEC to store initializers.
+	* call.c (convert_default_arg): Update call to digest_init.
+	* class.c (dump_class_hierarchy, dump_array): Update to cope with
+	VEC in CONSTRUCTOR_ELTS.
+	* cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise.
+	(finish_compound_literal, digest_init): Update declaration.
+	* decl.c (struct reshape_iter): New data type.
+	(reshape_init_array): Rename to...
+	(reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS.
+	(reshape_init): Rewrite from scratch. Split parts into...
+	(reshape_init_array, reshape_init_vector, reshape_init_class,
+	reshape_init_r): New functions.
+	(check_initializer): Update call to reshape_init. Remove obsolete
+	code.
+	(initialize_artificial_var, cp_complete_array_type): Update to cope
+	with VEC in CONSTRUCTOR_ELTS.
+	* decl2.c (grokfield): Update calls to digest_init.
+	(mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS.
+	* error.c (dump_expr_init_vec): New function.
+	(dump_expr): Use dump_expr_init_vec.
+	* init.c (build_zero_init, build_vec_init): Update to cope with VEC
+	in CONSTRUCTOR_ELTS.
+	(expand_default_init): Update call to digest_init.
+	* parser.c  (cp_parser_postfix_expression): Use a VEC for the
+	initializers.
+	(cp_parser_initializer_list): Build a VEC of initializers.
+	* pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC
+	in CONSTRUCTOR_ELTS.
+	* rtti.c (tinfo_base_init, generic_initializer, ptr_initializer,
+	ptm_initializer, class_initializer, get_pseudo_ti_init): Use
+	build_constructor_from_list instead of build_constructor.
+	* semantics.c (finish_compound_literal): Update call to digest_init.
+	* tree.c (stabilize_init): Update to cope with VEC in
+	CONSTRUCTOR_ELTS.
+	* typeck.c (build_ptrmemfunc1): Likewise.
+	* typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1):
+	Likewise.
+	(store_init_value): Use build_constructor_from_list and update call
+	to digest_init.
+	(digest_init): Rewrite.
+	(process_init_constructor): Rewrite from scratch. Split into...
+	(process_init_constructor_array, picflag_from_initializer,
+	process_init_constructor_record, process_init_constructor_union):
+	New functions.
+	(PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE):
+	New macros.
+	(build_functional_cast): Use build_constructor_from_list instead of
+	build_constructor.
+
 2005-07-18  Mark Mitchell  <mark@codesourcery.com>
 
 	PR c++/22263


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]