On Fri, 15 Jan 2016, Jan Hubicka wrote: > Hi, > this is last of my patches to improve partitionability of programs. > This patch compacts BLOCK_VARs lists and trows away TYPE_DECLs for -g0 > and redundant TYPE_DECLs on all levels. It does make noticeable difference > on firefox, but I managed to erase the numbers (can re-test them if requested) > > Bootstrapped/regtested x86_64-linux, OK?
Hmm. So I wonder why remove_unused_locals does not do this then or if it does not because it would change code-gen based on -g/-g0 I wonder why your patch wouldn't introduce that issue with LTO. That said - improve remove_unused_locals instead please? Thanks, Richard. > * tree.c (needed_in_block_vars_p): New function. > (free_lang_data_in_decl): Use it. > Index: tree.c > =================================================================== > --- tree.c (revision 232407) > +++ tree.c (working copy) > @@ -5343,6 +5343,42 @@ need_assembler_name_p (tree decl) > return true; > } > > +/* Return true if DECL should stay in BLOCK_VARs list. */ > + > +static inline bool > +needed_in_block_vars_p (const_tree decl) > +{ > + if (TREE_CODE (decl) == VAR_DECL && TREE_USED (decl) > + && (!TREE_STATIC (decl) || DECL_EXTERNAL (decl))) > + return true; > + if (TREE_CODE (decl) == RESULT_DECL) > + return true; > + /* Dwarf2out output non-fortran and non-ada const decls when the > + enum is output and it will not consider language to be ada or fortran > + in LTO. */ > + if (TREE_CODE (decl) == CONST_DECL) > + return false; > + if (debug_info_level >= DINFO_LEVEL_TERSE) > + return false; > + /* Strip builtins from the translation-unit BLOCK. We still have targets > + without builtin_decl_explicit support and also builtins are shared > + nodes and thus we can't use TREE_CHAIN in multiple lists. */ > + if (TREE_CODE (decl) == FUNCTION_DECL > + && DECL_BUILT_IN (decl)) > + return false; > + if (DECL_IGNORED_P (decl)) > + return false; > + if (TREE_CODE (decl) == TYPE_DECL > + && is_redundant_typedef (decl)) > + return false; > + gcc_checking_assert (TREE_CODE (decl) == TYPE_DECL > + || TREE_CODE (decl) == VAR_DECL > + || TREE_CODE (decl) == FUNCTION_DECL > + || TREE_CODE (decl) == LABEL_DECL > + || TREE_CODE (decl) == RESULT_DECL); > + return true; > +} > + > > /* Reset all language specific information still present in symbol > DECL. */ > @@ -5445,15 +5481,11 @@ free_lang_data_in_decl (tree decl) > && DECL_INITIAL (decl) > && TREE_CODE (DECL_INITIAL (decl)) == BLOCK) > { > - /* Strip builtins from the translation-unit BLOCK. We still have > targets > - without builtin_decl_explicit support and also builtins are shared > - nodes and thus we can't use TREE_CHAIN in multiple lists. */ > tree *nextp = &BLOCK_VARS (DECL_INITIAL (decl)); > while (*nextp) > { > tree var = *nextp; > - if (TREE_CODE (var) == FUNCTION_DECL > - && DECL_BUILT_IN (var)) > + if (needed_in_block_vars_p (var)) > *nextp = TREE_CHAIN (var); > else > nextp = &TREE_CHAIN (var); > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)