http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45375

--- Comment #97 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-06-02 
13:28:28 UTC ---
Today I noticed by an accident that the following hack:
Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c  (revision 174547)
+++ lto-streamer-out.c  (working copy)
@@ -1135,15 +1288,15 @@

   lto_output_tree_or_ref (ob, BINFO_OFFSET (expr), ref_p);
   lto_output_tree_or_ref (ob, BINFO_VTABLE (expr), ref_p);
-  lto_output_tree_or_ref (ob, BINFO_VIRTUALS (expr), ref_p);
+  /*lto_output_tree_or_ref (ob, BINFO_VIRTUALS (expr), ref_p);*/
   lto_output_tree_or_ref (ob, BINFO_VPTR_FIELD (expr), ref_p);

   output_uleb128 (ob, VEC_length (tree, BINFO_BASE_ACCESSES (expr)));
   FOR_EACH_VEC_ELT (tree, BINFO_BASE_ACCESSES (expr), i, t)
     lto_output_tree_or_ref (ob, t, ref_p);

-  lto_output_tree_or_ref (ob, BINFO_INHERITANCE_CHAIN (expr), ref_p);
-  lto_output_tree_or_ref (ob, BINFO_SUBVTT_INDEX (expr), ref_p);
+  /* Backend do not care about BINFO_INHERITANCE_CHAIN and BINFO_SUBVTT_INDEX.
+   */
   lto_output_tree_or_ref (ob, BINFO_VPTR_INDEX (expr), ref_p);
 }

@@ -2014,7 +2167,7 @@
     lto_output_tree_ref (ob, t);

   /* Output the head of the arguments list.  */
-  lto_output_tree_ref (ob, DECL_ARGUMENTS (function));
+  lto_output_chain (ob, DECL_ARGUMENTS (function), true);

   /* Output all the SSA names used in the function.  */
   output_ssa_names (ob, fn);
Index: lto-streamer-in.c
===================================================================
--- lto-streamer-in.c   (revision 174547)
+++ lto-streamer-in.c   (working copy)
@@ -2308,7 +2438,7 @@
   while (t);

   BINFO_OFFSET (expr) = lto_input_tree (ib, data_in);
-  BINFO_VTABLE (expr) = lto_input_tree (ib, data_in);
+  /*BINFO_VTABLE (expr) = lto_input_tree (ib, data_in);*/
   BINFO_VIRTUALS (expr) = lto_input_tree (ib, data_in);
   BINFO_VPTR_FIELD (expr) = lto_input_tree (ib, data_in);

@@ -2323,8 +2453,6 @@
        }
     }

-  BINFO_INHERITANCE_CHAIN (expr) = lto_input_tree (ib, data_in);
-  BINFO_SUBVTT_INDEX (expr) = lto_input_tree (ib, data_in);
   BINFO_VPTR_INDEX (expr) = lto_input_tree (ib, data_in);
 }


Reduces memory usage from 4.4GB to 2.7GB, so almost halves it and
proportionally improves compilation speed.  The effect is disabling type based
devirtualization.

The difference is amount of IL sreamed.  W/o hack
> [WPA] Compression: 430817772 input bytes, 2004640654 uncompressed bytes 
> (ratio: 4.653106)
> [WPA] Size of mmap'd section decls: 267817970 bytes
> [WPA] Size of mmap'd section function_body: 144808174 bytes
>  ipa lto decl in       :  74.90 (30%) usr   2.38 (19%) sys  77.51 (29%) wall  
> 722892 kB (44%) ggc

(ggc memory info wraps around 4GB limit, have patch for that)

With hack:
> [WPA] Compression: 308616744 input bytes, 1236371760 uncompressed bytes 
> (ratio: 4.006172)
> [WPA] Size of mmap'd section decls: 147396203 bytes
> [WPA] Size of mmap'd section function_body: 144662716 bytes
>  ipa lto decl in       :  38.85 (23%) usr   1.18 (12%) sys  40.12 (23%) wall 
> 2674626 kB (75%) ggc

The node stats with the patch are as follows:
identifier_node       505095
tree_list            1809449
integer_type          175310
pointer_type         1198885
reference_type         65356
array_type             96153
record_type           729335
union_type             14171
function_type         120632
method_type           504881
integer_cst           587216
string_cst            204367
function_decl         909919
label_decl            261908
field_decl           1278114
var_decl               87787
const_decl            327835
parm_decl            1653719
type_decl             771617
result_decl           559971
debug_expr_decl       147434
constructor           162322
nop_expr              531950
addr_expr             920865
tree_binfo           1013612

(to be compared with my previous stats)

Heap vector stats:

ipa-prop.c:2053 (ipa_node_duplication_hook)          540408: 0.8%    1046048   
       21339: 0.2%
ipa-inline-analysis.c:2008 (inline_merge_summary    1697908: 2.5%    3086804   
       99582: 1.1%
ipa-reference.c:185 (set_reference_optimization_    6122784: 9.0%   10353528   
          10: 0.0%
lto-cgraph.c:113 (lto_cgraph_encoder_encode)        6485840: 9.5%   10924352   
       22118: 0.2%
ipa-ref.c:59 (ipa_record_reference)                16005792:23.5%   20789048   
      534854: 6.0%
ipa-inline-analysis.c:647 (inline_summary_alloc)   17904344:26.3%   35257432   
       11486: 0.1%
passes.c:1893 (execute_one_pass)                   18076256:26.5%   20971480   
      474948: 5.3%
Total                                              68129708                    
      8892582

GGC stats:
ipa-inline-analysis.c:841 (inline_node_duplicati          0: 0.0%      42428:
0.0%   37876224: 2.3%    2058852: 0.6%     232982
gimple.c:4177 (iterative_hash_gimple_type)         43510016: 2.8%          0:
0.0%          0: 0.0%          0: 0.0%    2719376
lto-symtab.c:156 (lto_symtab_register_decl)        50215704: 3.3%          0:
0.0%          0: 0.0%          0: 0.0%     896709
lto-section-in.c:471 (lto_new_in_decl_state)         165360: 0.0%          0:
0.0%   51424080: 3.2%          0: 0.0%     429912
cgraph.c:1008 (cgraph_create_edge_1)                      0: 0.0%          0:
0.0%   77585352: 4.8%          0: 0.0%     746013
lto-streamer-in.c:2477 (lto_input_ts_constructor   34780240: 2.3%   67555760:
8.4%   45650928: 2.8%   33677352:10.4%     271362
ipa-inline-analysis.c:643 (inline_summary_alloc)          0: 0.0%          0:
0.0%   85235448: 5.3%   18126584: 5.6%          1
ipa-ref.c:54 (ipa_record_reference)                       0: 0.0% 
171658064:21.4%   85633072: 5.3%   68326696:21.0%     554106
lto-streamer-in.c:1934 (lto_materialize_tree)      90241344: 5.9%          0:
0.0%   11233544: 0.7%       5872: 0.0%    1013612
lto/lto.c:217 (lto_read_in_decl_state)               333288: 0.0%          0:
0.0%  130600080: 8.1%   24601136: 7.6%    3009384
toplev.c:1027 (realloc_for_line_map)                      0: 0.0% 
167815168:20.9%  167778304:10.4%   67182592:20.7%         14
tree.c:1223 (build_int_cst_wide)                  200129008:13.0%          0:
0.0%    2046496: 0.1%   66567480:20.5%      40217
cgraph.c:457 (cgraph_allocate_node)                       0: 0.0%          0:
0.0%  226542712:14.0%          0: 0.0%     765347
lto-streamer-in.c:1939 (lto_materialize_tree)    1077917488:70.1%          0:
0.0%  540532272:33.4%   28671712: 8.8%   12277142
Total                                            1537795379        803354140   
   1619917572        325016043         27622283
source location                                     Garbage            Freed   
         Leak         Overhead            Times

Honza

Reply via email to