re PR lto/83804 ([meta] LTO memory consumption)

2018-01-15  Richard Biener  <rguenther@suse.de>

	PR lto/83804
	* tree.c (free_lang_data_in_type): Always unlink TYPE_DECLs
	from TYPE_FIELDS.  Free TYPE_BINFO if not used by devirtualization.
	Reset type names to their identifier if their TYPE_DECL doesn't
	have linkage (and thus is used for ODR and devirt).
	(save_debug_info_for_decl): Remove.
	(save_debug_info_for_type): Likewise.
	(add_tree_to_fld_list): Adjust.
	* tree-pretty-print.c (dump_generic_node): Make dumping of
	type names more robust.

From-SVN: r256685
This commit is contained in:
Richard Biener 2018-01-15 08:57:28 +00:00 committed by Richard Biener
parent a55e8b53d0
commit 2aa89839f5
3 changed files with 30 additions and 59 deletions

View File

@ -1,3 +1,16 @@
2018-01-15 Richard Biener <rguenther@suse.de>
PR lto/83804
* tree.c (free_lang_data_in_type): Always unlink TYPE_DECLs
from TYPE_FIELDS. Free TYPE_BINFO if not used by devirtualization.
Reset type names to their identifier if their TYPE_DECL doesn't
have linkage (and thus is used for ODR and devirt).
(save_debug_info_for_decl): Remove.
(save_debug_info_for_type): Likewise.
(add_tree_to_fld_list): Adjust.
* tree-pretty-print.c (dump_generic_node): Make dumping of
type names more robust.
2018-01-15 Richard Biener <rguenther@suse.de> 2018-01-15 Richard Biener <rguenther@suse.de>
* BASE-VER: Bump to 8.0.1. * BASE-VER: Bump to 8.0.1.

View File

@ -1412,8 +1412,8 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
pp_space (pp); pp_space (pp);
pp_left_paren (pp); pp_left_paren (pp);
pp_string (pp, str); pp_string (pp, str);
if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node))) if (TYPE_IDENTIFIER (node))
dump_decl_name (pp, TYPE_NAME (node), flags); dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
else if (flags & TDF_NOUID) else if (flags & TDF_NOUID)
pp_printf (pp, "<Txxxx>"); pp_printf (pp, "<Txxxx>");
else else
@ -1816,8 +1816,8 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
if (TREE_CODE (node) == METHOD_TYPE) if (TREE_CODE (node) == METHOD_TYPE)
{ {
if (TYPE_METHOD_BASETYPE (node)) if (TYPE_METHOD_BASETYPE (node))
dump_decl_name (pp, TYPE_NAME (TYPE_METHOD_BASETYPE (node)), dump_generic_node (pp, TYPE_NAME (TYPE_METHOD_BASETYPE (node)),
flags); spc, flags, false);
else else
pp_string (pp, "<null method basetype>"); pp_string (pp, "<null method basetype>");
pp_colon_colon (pp); pp_colon_colon (pp);

View File

@ -5128,15 +5128,10 @@ free_lang_data_in_type (tree type)
TREE_PURPOSE (p) = NULL; TREE_PURPOSE (p) = NULL;
else if (RECORD_OR_UNION_TYPE_P (type)) else if (RECORD_OR_UNION_TYPE_P (type))
{ {
/* Remove members that are not FIELD_DECLs (and maybe /* Remove members that are not FIELD_DECLs from the field list
TYPE_DECLs) from the field list of an aggregate. These occur of an aggregate. These occur in C++. */
in C++. */
for (tree *prev = &TYPE_FIELDS (type), member; (member = *prev);) for (tree *prev = &TYPE_FIELDS (type), member; (member = *prev);)
if (TREE_CODE (member) == FIELD_DECL if (TREE_CODE (member) == FIELD_DECL)
|| (TREE_CODE (member) == TYPE_DECL
&& !DECL_IGNORED_P (member)
&& debug_info_level > DINFO_LEVEL_TERSE
&& !is_redundant_typedef (member)))
prev = &DECL_CHAIN (member); prev = &DECL_CHAIN (member);
else else
*prev = DECL_CHAIN (member); *prev = DECL_CHAIN (member);
@ -5150,15 +5145,9 @@ free_lang_data_in_type (tree type)
{ {
free_lang_data_in_binfo (TYPE_BINFO (type)); free_lang_data_in_binfo (TYPE_BINFO (type));
/* We need to preserve link to bases and virtual table for all /* We need to preserve link to bases and virtual table for all
polymorphic types to make devirtualization machinery working. polymorphic types to make devirtualization machinery working. */
Debug output cares only about bases, but output also if (!BINFO_VTABLE (TYPE_BINFO (type))
virtual table pointers so merging of -fdevirtualize and || !flag_devirtualize)
-fno-devirtualize units is easier. */
if ((!BINFO_VTABLE (TYPE_BINFO (type))
|| !flag_devirtualize)
&& ((!BINFO_N_BASE_BINFOS (TYPE_BINFO (type))
&& !BINFO_VTABLE (TYPE_BINFO (type)))
|| debug_info_level != DINFO_LEVEL_NONE))
TYPE_BINFO (type) = NULL; TYPE_BINFO (type) = NULL;
} }
} }
@ -5186,6 +5175,11 @@ free_lang_data_in_type (tree type)
while (ctx && TREE_CODE (ctx) == BLOCK); while (ctx && TREE_CODE (ctx) == BLOCK);
TYPE_CONTEXT (type) = ctx; TYPE_CONTEXT (type) = ctx;
} }
/* Drop TYPE_DECLs in TYPE_NAME in favor of the identifier in the
TYPE_DECL if the type doesn't have linkage. */
if (! type_with_linkage_p (type))
TYPE_NAME (type) = TYPE_IDENTIFIER (type);
} }
@ -5408,34 +5402,6 @@ struct free_lang_data_d
}; };
/* Save all language fields needed to generate proper debug information
for DECL. This saves most fields cleared out by free_lang_data_in_decl. */
static void
save_debug_info_for_decl (tree t)
{
/*struct saved_debug_info_d *sdi;*/
gcc_assert (debug_info_level > DINFO_LEVEL_TERSE && t && DECL_P (t));
/* FIXME. Partial implementation for saving debug info removed. */
}
/* Save all language fields needed to generate proper debug information
for TYPE. This saves most fields cleared out by free_lang_data_in_type. */
static void
save_debug_info_for_type (tree t)
{
/*struct saved_debug_info_d *sdi;*/
gcc_assert (debug_info_level > DINFO_LEVEL_TERSE && t && TYPE_P (t));
/* FIXME. Partial implementation for saving debug info removed. */
}
/* Add type or decl T to one of the list of tree nodes that need their /* Add type or decl T to one of the list of tree nodes that need their
language data removed. The lists are held inside FLD. */ language data removed. The lists are held inside FLD. */
@ -5443,17 +5409,9 @@ static void
add_tree_to_fld_list (tree t, struct free_lang_data_d *fld) add_tree_to_fld_list (tree t, struct free_lang_data_d *fld)
{ {
if (DECL_P (t)) if (DECL_P (t))
{ fld->decls.safe_push (t);
fld->decls.safe_push (t);
if (debug_info_level > DINFO_LEVEL_TERSE)
save_debug_info_for_decl (t);
}
else if (TYPE_P (t)) else if (TYPE_P (t))
{ fld->types.safe_push (t);
fld->types.safe_push (t);
if (debug_info_level > DINFO_LEVEL_TERSE)
save_debug_info_for_type (t);
}
else else
gcc_unreachable (); gcc_unreachable ();
} }