> On Fri, 11 Dec 2015, Jan Hubicka wrote:
> 
> > > 
> > > We explicitely do not use debug-info-level tests in free-lang-data
> > > to allow mixing -g and -g0 objects.  Are you sure doing the above
> > > doesn't mess up tree merging enough to effectively enlarge WPA
> > > memory use and the merged decl sections?
> > > 
> > > [I'm quite sure firefox build system manages to mess up -g vs. -g0
> > > in some places ;)]
> > 
> > Hmm, I will try the debug build with firefox on this.  -fdump-ipa-devirt
> > now dumps all main variants that are duplicates of one ODR type.
> > We definitely have types with hundreds of duplicates, so there are
> > quite common cases where tree merging does not fire.
> > > 
> > > > +  return (!DECL_IGNORED_P (decl) && !is_redundant_typedef (decl));
> > > > +}
> > > > +
> > > 
> > > The patch would be ok if you simply export is_redundant_typedef
> > > and inline the DECL_IGNORED_P check into free-lang-data.
> > 
> > OK, I had that originally, will return that back.
> > is_redundant_typedef is declared inline.  Putting it to tree.h drags
> > bit too many dwarf2out internals, but I suppose it is OK to just
> > turn it non-inline.  It is a type of function where inliner should be
> > able to decide.
> 
> Yeah.
Hi,
this is a variant of patch I re-tested (x86_64-linux) and comitted.  I also
double checked that it results in smaller meomry footprint on the -g/-no-g
mixed build of firefox (I built Javascript without debug and rest with).
THe tree merging is affected but not in very significant way.  Hopefully
this will all go early next stage1 with early debug :)

I also noticed that TYPE_DECLs are common in BLOCK_VARs. I will check how
many of them can be shaved off and if that furhter increases partitionability.

The size of largest ltransp partition with this patch and debug shrinks
from 862k trees to 710k trees and for a first time I am aware of we get
both debug and non-debug builds under 3GB of WPA on my firefox tree (that
is from the time GCC 5 was released - I will update it once I get past issues
on this one)

Thanks,
Honza

        * tree.c (free_lang_data_in_type, find_decls_types_r): Also free
        unnecesary type decls.
        * tree.h (is_redundant_typedef): Declare.
        * dwarf2out.c (is_redundant_typedef): Export; booleanize
Index: tree.c
===================================================================
--- tree.c      (revision 231581)
+++ tree.c      (working copy)
@@ -5191,7 +5191,10 @@ free_lang_data_in_type (tree type)
       while (member)
        {
          if (TREE_CODE (member) == FIELD_DECL
-             || TREE_CODE (member) == TYPE_DECL)
+             || (TREE_CODE (member) == TYPE_DECL
+                 && !DECL_IGNORED_P (member)
+                 && debug_info_level > DINFO_LEVEL_TERSE
+                 && !is_redundant_typedef (member)))
            {
              if (prev)
                TREE_CHAIN (prev) = member;
@@ -5216,7 +5219,7 @@ free_lang_data_in_type (tree type)
       /* Remove TYPE_METHODS list.  While it would be nice to keep it
         to enable ODR warnings about different method lists, doing so
         seems to impractically increase size of LTO data streamed.
-        Keep the infrmation if TYPE_METHODS was non-NULL. This is used
+        Keep the information if TYPE_METHODS was non-NULL. This is used
         by function.c and pretty printers.  */
       if (TYPE_METHODS (type))
         TYPE_METHODS (type) = error_mark_node;
@@ -5666,7 +5669,10 @@ find_decls_types_r (tree *tp, int *ws, v
          while (tem)
            {
              if (TREE_CODE (tem) == FIELD_DECL
-                 || TREE_CODE (tem) == TYPE_DECL)
+                 || (TREE_CODE (tem) == TYPE_DECL
+                     && !DECL_IGNORED_P (tem)
+                     && debug_info_level > DINFO_LEVEL_TERSE
+                     && !is_redundant_typedef (tem)))
                fld_worklist_push (tem, fld);
              tem = TREE_CHAIN (tem);
            }
Index: tree.h
===================================================================
--- tree.h      (revision 231581)
+++ tree.h      (working copy)
@@ -5386,6 +5386,7 @@ extern void gt_pch_nx (tree &);
 extern void gt_pch_nx (tree &, gt_pointer_operator, void *);
 
 extern bool nonnull_arg_p (const_tree);
+extern bool is_redundant_typedef (const_tree);
 
 extern location_t
 set_source_range (tree expr, location_t start, location_t finish);
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 231581)
+++ dwarf2out.c (working copy)
@@ -3319,7 +3319,6 @@ static void gen_typedef_die (tree, dw_di
 static void gen_type_die (tree, dw_die_ref);
 static void gen_block_die (tree, dw_die_ref);
 static void decls_for_scope (tree, dw_die_ref);
-static inline int is_redundant_typedef (const_tree);
 static bool is_naming_typedef_decl (const_tree);
 static inline dw_die_ref get_context_die (tree);
 static void gen_namespace_die (tree, dw_die_ref);
@@ -21117,11 +21116,11 @@ decls_for_scope (tree stmt, dw_die_ref c
 
 /* Is this a typedef we can avoid emitting?  */
 
-static inline int
+bool
 is_redundant_typedef (const_tree decl)
 {
   if (TYPE_DECL_IS_STUB (decl))
-    return 1;
+    return true;
 
   if (DECL_ARTIFICIAL (decl)
       && DECL_CONTEXT (decl)
@@ -21129,9 +21128,9 @@ is_redundant_typedef (const_tree decl)
       && TREE_CODE (TYPE_NAME (DECL_CONTEXT (decl))) == TYPE_DECL
       && DECL_NAME (decl) == DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))))
     /* Also ignore the artificial member typedef for the class name.  */
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
 /* Return TRUE if TYPE is a typedef that names a type for linkage

Reply via email to