Hi,

On Mon, 22 Aug 2011, Richard Guenther wrote:

> > Some functions are extremely large though.  Do you mean that MEM 
> > itself would be enlarged to have the MEM_ATTRS field so that one 
> > operand is the address, then expr, then HWI size, offset, etc.? 
> >  Because if the mem attrs aren't shared any longer, it doesn't make 
> > sense to keep the indirection. I still fear we have way too many MEMs 
> > in RTL that this would be noticeable.
> 
> It would be interesting to have numbers about the amount of sharing that 
> happens

A pathetic amount.  From compiling cse.c combine.c tree.c and dwarf2out.c 
the top 10 users of MEMs per routine are:

With -O0:
MEMs  ATTR  name
970   485   combine_simplify_rtx
1011  464   simple_cst_equal
1047  612   mem_loc_descriptor
1173  442   walk_tree_1
1296  515   loc_list_from_tree
1431  690   simplify_comparison
1911  752   substitute_placeholder_in_expr
1951  745   substitute_in_expr
2503  1532  cse_insn
3242  2206  try_combine

With -O2:
MEMs  ATTR  name
514   502   gen_tagged_type_die
701   536   simplify_comparison
743   877   find_decls_types_r
851   840   dwarf2out_finish
863   784   loc_list_from_tree
916   839   combine_simplify_rtx
978   878   gen_subprogram_die
1650  1475  cse_insn
1720  1782  mem_loc_descriptor
2336  1792  try_combine

Summing doesn't make sense, but the routines with largest differences:
-O0
532 force_to_mode
547 simple_cst_equal
640 simplify_shift_const_1
731 walk_tree_1
741 simplify_comparison
781 loc_list_from_tree
971 cse_insn
1036 try_combine
1159 substitute_placeholder_in_expr
1206 substitute_in_expr

-O2
100 gen_subprogram_die
101 make_extraction
112 output_loc_sequence
122 if_then_else_cond
124 substitute_placeholder_in_expr
144 simplify_shift_const_1
165 simplify_comparison
175 cse_insn
205 simplify_if_then_else
544 try_combine

(Using -g or not doesn't make a difference).  I've counted all MEM rtx in 
the whole insn stream at finalization time (i.e. slightly less than 
potentially are actually generated during RTL passes).  ATTR is the number 
of unique mem_attrs ever created by set_mem_attrs, reset to zero at each 
function start (including emptying the htab).

That is, we save a whopping 48 kilobyte due to this fantastic hash table 
:-)  (offseted by the need for a pointer in the MEM rtx)

Just remove the whole thing.  Same for the reg_attrs hash table (I haven't 
measured that one, though).

> - might be not trivial though, as some re-uses would be able to 
> simply modify the attr inplace.


Ciao,
Michael.

Reply via email to