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:
    Overall memory needed: 24721k -> 24725k
    Peak memory use before GGC: 9591k
    Peak memory use after GGC: 8938k
    Maximum of released memory in single GGC run: 2754k
    Garbage: 41378k
    Leak: 6709k
    Overhead: 5842k
    GGC runs: 320

comparing combine.c compilation at -O1 level:
  Amount of produced GGC garbage increased from 66951k to 70041k, overall 4.61%
  Amount of memory still referenced at the end of compilation increased from 7044k to 7171k, overall 1.80%
    Overall memory needed: 23924k -> 23916k
    Peak memory use before GGC: 17373k -> 17376k
    Peak memory use after GGC: 17181k
    Maximum of released memory in single GGC run: 2435k -> 2436k
    Garbage: 66951k -> 70041k
    Leak: 7044k -> 7171k
    Overhead: 8018k -> 8660k
    GGC runs: 410 -> 426

comparing combine.c compilation at -O2 level:
  Amount of produced GGC garbage increased from 85030k to 88288k, overall 3.83%
  Amount of memory still referenced at the end of compilation increased from 7223k to 7397k, overall 2.42%
    Overall memory needed: 23920k -> 23928k
    Peak memory use before GGC: 17381k -> 17383k
    Peak memory use after GGC: 17181k
    Maximum of released memory in single GGC run: 2519k
    Garbage: 85030k -> 88288k
    Leak: 7223k -> 7397k
    Overhead: 10527k -> 11231k
    GGC runs: 478 -> 501

comparing combine.c compilation at -O3 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 17634k to 17693k, overall 0.33%
  Peak amount of GGC memory still allocated after garbage collectin increased from 17223k to 17257k, overall 0.20%
  Amount of produced GGC garbage increased from 113290k to 119222k, overall 5.24%
  Amount of memory still referenced at the end of compilation increased from 7276k to 7470k, overall 2.67%
    Overall memory needed: 24380k -> 24436k
    Peak memory use before GGC: 17634k -> 17693k
    Peak memory use after GGC: 17223k -> 17257k
    Maximum of released memory in single GGC run: 3375k -> 3371k
    Garbage: 113290k -> 119222k
    Leak: 7276k -> 7470k
    Overhead: 13713k -> 15004k
    GGC runs: 523 -> 545

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 81648k
    Peak memory use before GGC: 70268k
    Peak memory use after GGC: 45007k
    Maximum of released memory in single GGC run: 37046k
    Garbage: 149716k
    Leak: 11585k
    Overhead: 19128k
    GGC runs: 252

comparing insn-attrtab.c compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 98247k to 100093k, overall 1.88%
  Peak amount of GGC memory still allocated after garbage collectin increased from 87757k to 89154k, overall 1.59%
  Amount of produced GGC garbage increased from 296518k to 300331k, overall 1.29%
  Amount of memory still referenced at the end of compilation increased from 11466k to 11547k, overall 0.71%
    Overall memory needed: 115388k -> 116448k
    Peak memory use before GGC: 98247k -> 100093k
    Peak memory use after GGC: 87757k -> 89154k
    Maximum of released memory in single GGC run: 33049k
    Garbage: 296518k -> 300331k
    Leak: 11466k -> 11547k
    Overhead: 36055k -> 38189k
    GGC runs: 280 -> 288

comparing insn-attrtab.c compilation at -O2 level:
  Amount of produced GGC garbage increased from 383092k to 385555k, overall 0.64%
  Amount of memory still referenced at the end of compilation increased from 11581k to 11662k, overall 0.71%
    Overall memory needed: 124820k -> 124852k
    Peak memory use before GGC: 117503k -> 117531k
    Peak memory use after GGC: 87738k -> 87156k
    Maximum of released memory in single GGC run: 32732k
    Garbage: 383092k -> 385555k
    Leak: 11581k -> 11662k
    Overhead: 47927k -> 49187k
    GGC runs: 320 -> 326

comparing insn-attrtab.c compilation at -O3 level:
  Amount of produced GGC garbage increased from 383630k to 386106k, overall 0.65%
  Amount of memory still referenced at the end of compilation increased from 11599k to 11678k, overall 0.69%
    Overall memory needed: 124820k -> 124848k
    Peak memory use before GGC: 117504k -> 117532k
    Peak memory use after GGC: 87742k -> 87158k
    Maximum of released memory in single GGC run: 32732k
    Garbage: 383630k -> 386106k
    Leak: 11599k -> 11678k
    Overhead: 48080k -> 49344k
    GGC runs: 324 -> 329

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 119108k
    Peak memory use before GGC: 95788k
    Peak memory use after GGC: 94840k
    Maximum of released memory in single GGC run: 20762k
    Garbage: 224400k
    Leak: 49424k
    Overhead: 36945k
    GGC runs: 339

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Amount of produced GGC garbage increased from 630475k to 647393k, overall 2.68%
  Amount of memory still referenced at the end of compilation increased from 54752k to 55260k, overall 0.93%
    Overall memory needed: 104096k -> 104600k
    Peak memory use before GGC: 94848k
    Peak memory use after GGC: 93906k
    Maximum of released memory in single GGC run: 19825k
    Garbage: 630475k -> 647393k
    Leak: 54752k -> 55260k
    Overhead: 76838k -> 78204k
    GGC runs: 529 -> 543

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Amount of produced GGC garbage increased from 720593k to 725486k, overall 0.68%
  Amount of memory still referenced at the end of compilation increased from 55431k to 56293k, overall 1.56%
    Overall memory needed: 104636k -> 104912k
    Peak memory use before GGC: 94848k
    Peak memory use after GGC: 93906k
    Maximum of released memory in single GGC run: 19825k
    Garbage: 720593k -> 725486k
    Leak: 55431k -> 56293k
    Overhead: 93231k -> 88854k
    GGC runs: 602 -> 614

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Amount of produced GGC garbage increased from 762805k to 772175k, overall 1.23%
  Amount of memory still referenced at the end of compilation increased from 56583k to 56822k, overall 0.42%
    Overall memory needed: 106540k -> 106780k
    Peak memory use before GGC: 95930k
    Peak memory use after GGC: 94979k
    Maximum of released memory in single GGC run: 19927k
    Garbage: 762805k -> 772175k
    Leak: 56583k -> 56822k
    Overhead: 97352k -> 93117k
    GGC runs: 609 -> 634

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2005-07-09 22:14:24.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2005-07-10 08:54:35.000000000 +0000
@@ -1,3 +1,87 @@
+2005-07-09  Diego Novillo  <dnovillo@redhat.com>
+
+	* Makefile.in (tree-ssa-alias.o): Depend on tree-ssa-structalias.h
+	* tree-cfg.c (CHECK_OP): Only test for is_gimple_val.
+	* tree-dfa.c (dump_subvars_for): New.
+	(debug_subvars_for): New.
+	(dump_variable): Show subvariables if VAR has them.
+	* tree-flow-inline.h (get_subvar_at): New.
+	(overlap_subvar): Change offset and size to unsigned HOST_WIDE_INT.
+	* tree-flow.h (struct ptr_info_def): Remove field pt_malloc.
+	Update all users.
+	(struct subvar): Change fields offset and size to unsigned
+	HOST_WIDE_INT.
+	(dump_subvars_for): Declare.
+	(debug_subvars_for): Declare.
+	(get_subvar_at): Declare.
+	(okay_component_ref_for_subvars): Change 2nd and 3rd argument
+	to unsigned HOST_WIDE_INT *.
+	(overlap_subvar): Likewise.
+	* tree-gimple.c (is_gimple_reg): Always return false for
+	SFTs and memory tags.
+	* tree-pass.h (pass_build_pta, pass_del_pta): Remove.
+	Update all callers.
+	* tree-ssa-alias.c: Include tree-ssa-structalias.h.
+	(compute_may_aliases): Call compute_points_to_sets.
+	(collect_points_to_info_for): Remove.
+	(compute_points_to_and_addr_escape): Remove.
+	(delete_alias_info): Call delete_points_to_sets.
+	(compute_flow_sensitive_aliasing): If the call to
+	find_what_p_points_to returns false, call set_pt_anything.
+	(add_may_alias): Set TREE_ADDRESSABLE when adding a new alias.
+	(set_pt_anything): Clear pi->pt_vars.
+	(set_pt_malloc): Remove.
+	(merge_pointed_to_info): Remove.
+	(add_pointed_to_expr): Remove.
+	(add_pointed_to_var): Remove.
+	(collect_points_to_info_r): Remove.
+	(is_escape_site): Make extern.
+	(create_sft): New.
+	(create_overlap_variables_for): Call it.
+	* tree-ssa-copy.c (merge_alias_info): Never merge
+	flow-sensitive alias information.
+	* tree-ssa-operands.c (get_expr_operands): Adjust variables
+	offset and size to be unsigned HOST_WIDE_INT.
+	(add_to_addressable_set): Rename from note_addressable.
+	Set TREE_ADDRESSABLE as the variables are added to the set.
+	Update all users.
+	(add_stmt_operand): Do not try to micro-optimize unmodifiable
+	operands into VUSEs when adding V_MAY_DEFs for members in an
+	alias set.
+	* tree-ssa-operands.h (add_to_addressable_set): Declare.
+	* tree-ssa-structalias.c: Include tree-ssa-structalias.h last.
+	(struct variable_info): Add bitfield is_heap_var.
+	(var_anyoffset, anyoffset_tree, anyoffset_id): Declare.
+	(new_var_info): Initialize is_heap_var.
+	(get_constraint_for): Add HEAP variables to the symbol table.
+	Mark them with is_heap_var.
+	(update_alias_info): New.  Taken mostly from the old
+	compute_points_to_and_addr_escape.
+	(handle_ptr_arith): New.
+	(find_func_aliases): Call update_alias_info.
+	Call handle_ptr_info for tcc_binary expressions.
+	Call mark_stmt_modified.
+	(create_variable_info_for): If DECL has subvars, do not create
+	variables for its subvars.  Always add all the fields.
+	(set_uids_in_ptset): If the solution includes ANYOFFSET and
+	SFTs, then add all the SFTs of the structure.
+	If VI->DECL is an aggregate with subvariables, add the SFT at
+	VI->OFFSET.
+	(find_what_p_points_to): If VI is an artificial variable,
+	translate to bitfields in SSA_NAME_PTR_INFO.
+	If the solution is empty, set pi->pt_vars to NULL
+	(init_base_vars): Create ANYOFFSET.
+	(compute_points_to_sets): Rename from create_alias_vars.
+	Make extern.
+	(pass_build_pta): Remove.
+	(delete_points_to_sets): Rename from delete_alias_vars.
+	(pass_del_pta): Remove.
+	* tree-ssa-structalias.h (struct alias_info): Move from
+	tree-ssa-alias.h.
+	(NUM_REFERENCES, NUM_REFERENCES_CLEAR, NUM_REFERENCES_INC,
+	NUM_REFERENCES_SET): Likewise.
+	(compute_points_to_sets, delete_points_to_sets): Declare.
+
 2005-07-09  Richard Henderson  <rth@redhat.com>
 
 	* config/alpha/alpha.c (emit_insxl, alpha_expand_compare_and_swap_12,


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]