Commit 2ebbdb6c by Jan Hubicka Committed by Jan Hubicka

lto-streamer-out.c (DFS::DFS_write_tree_body): Do not follow TYPE_STUB_DECL.


	* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not follow
	TYPE_STUB_DECL.
	(hash_tree): Do not visit TYPE_STUB_DECL.
	* tree-streamer-out.c (write_ts_type_common_tree_pointers): Do not
	stream TYPE_STUB_DECL.
	* tree-streamer-in.c (lto_input_ts_type_common_tree_pointers): Likewise.
	* ipa-utils.h (type_with_linkage_p): Do not rely on TYPE_STUB_DECL
	after free_lang_data.
	(type_in_anonymous_namespace_p): Likewise.

From-SVN: r263985
parent 21592ebe
2018-08-29 Jan Hubicka <jh@suse.cz> 2018-08-29 Jan Hubicka <jh@suse.cz>
* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not follow
TYPE_STUB_DECL.
(hash_tree): Do not visit TYPE_STUB_DECL.
* tree-streamer-out.c (write_ts_type_common_tree_pointers): Do not
stream TYPE_STUB_DECL.
* tree-streamer-in.c (lto_input_ts_type_common_tree_pointers): Likewise.
* ipa-utils.h (type_with_linkage_p): Do not rely on TYPE_STUB_DECL
after free_lang_data.
(type_in_anonymous_namespace_p): Likewise.
2018-08-29 Jan Hubicka <jh@suse.cz>
* sreal.h (SREAL_PART_BITS): Change to 31; remove seemingly unnecessary * sreal.h (SREAL_PART_BITS): Change to 31; remove seemingly unnecessary
comment that it has to be even number. comment that it has to be even number.
(class sreal): Change m_sig type to int32_t. (class sreal): Change m_sig type to int32_t.
......
...@@ -179,22 +179,24 @@ polymorphic_type_binfo_p (const_tree binfo) ...@@ -179,22 +179,24 @@ polymorphic_type_binfo_p (const_tree binfo)
inline bool inline bool
type_with_linkage_p (const_tree t) type_with_linkage_p (const_tree t)
{ {
if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL)
|| !TYPE_STUB_DECL (t)) return false;
/* To support -fno-lto-odr-type-merigng recognize types with vtables
to have linkage. */
if (RECORD_OR_UNION_TYPE_P (t)
&& TYPE_BINFO (t) && BINFO_VTABLE (TYPE_BINFO (t)))
return true;
/* After free_lang_data was run and -flto-odr-type-merging we can recongize
types with linkage by presence of mangled name. */
if (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)))
return true;
/* If free lang data was not run check if indeed the type looks like C++
type with linkage. */
if (in_lto_p || !TYPE_STUB_DECL (t))
return false; return false;
/* In LTO do not get confused by non-C++ produced types or types built
with -fno-lto-odr-type-merigng. */
if (in_lto_p)
{
/* To support -fno-lto-odr-type-merigng recognize types with vtables
to have linkage. */
if (RECORD_OR_UNION_TYPE_P (t)
&& TYPE_BINFO (t) && BINFO_VTABLE (TYPE_BINFO (t)))
return true;
/* With -flto-odr-type-merging C++ FE specify mangled names
for all types with the linkage. */
return DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t));
}
if (!RECORD_OR_UNION_TYPE_P (t) && TREE_CODE (t) != ENUMERAL_TYPE) if (!RECORD_OR_UNION_TYPE_P (t) && TREE_CODE (t) != ENUMERAL_TYPE)
return false; return false;
...@@ -214,18 +216,16 @@ type_in_anonymous_namespace_p (const_tree t) ...@@ -214,18 +216,16 @@ type_in_anonymous_namespace_p (const_tree t)
{ {
gcc_checking_assert (type_with_linkage_p (t)); gcc_checking_assert (type_with_linkage_p (t));
if (!TREE_PUBLIC (TYPE_STUB_DECL (t))) /* free_lang_data clears TYPE_STUB_DECL but sets assembler name to
{ "<anon>" */
/* C++ FE uses magic <anon> as assembler names of anonymous types. if (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)))
verify that this match with type_in_anonymous_namespace_p. */ return !strcmp ("<anon>",
gcc_checking_assert (!in_lto_p IDENTIFIER_POINTER
|| !DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)) (DECL_ASSEMBLER_NAME (TYPE_NAME (t))));
|| !strcmp ("<anon>", else if (!TYPE_STUB_DECL (t))
IDENTIFIER_POINTER return false;
(DECL_ASSEMBLER_NAME (TYPE_NAME (t))))); else
return true; return !TREE_PUBLIC (TYPE_STUB_DECL (t));
}
return false;
} }
/* Return true of T is type with One Definition Rule info attached. /* Return true of T is type with One Definition Rule info attached.
......
...@@ -857,7 +857,9 @@ DFS::DFS_write_tree_body (struct output_block *ob, ...@@ -857,7 +857,9 @@ DFS::DFS_write_tree_body (struct output_block *ob,
DFS_follow_tree_edge (TYPE_CONTEXT (expr)); DFS_follow_tree_edge (TYPE_CONTEXT (expr));
/* TYPE_CANONICAL is re-computed during type merging, so no need /* TYPE_CANONICAL is re-computed during type merging, so no need
to follow it here. */ to follow it here. */
DFS_follow_tree_edge (TYPE_STUB_DECL (expr)); /* Do not stream TYPE_STUB_DECL; it is not needed by LTO but currently
it can not be freed by free_lang_data without triggering ICEs in
langhooks. */
} }
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON)) if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
...@@ -1269,7 +1271,6 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map, ...@@ -1269,7 +1271,6 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map,
; ;
else else
visit (TYPE_CONTEXT (t)); visit (TYPE_CONTEXT (t));
visit (TYPE_STUB_DECL (t));
} }
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON)) if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
......
...@@ -819,7 +819,6 @@ lto_input_ts_type_common_tree_pointers (struct lto_input_block *ib, ...@@ -819,7 +819,6 @@ lto_input_ts_type_common_tree_pointers (struct lto_input_block *ib,
TYPE_CONTEXT (expr) = stream_read_tree (ib, data_in); TYPE_CONTEXT (expr) = stream_read_tree (ib, data_in);
/* TYPE_CANONICAL gets re-computed during type merging. */ /* TYPE_CANONICAL gets re-computed during type merging. */
TYPE_CANONICAL (expr) = NULL_TREE; TYPE_CANONICAL (expr) = NULL_TREE;
TYPE_STUB_DECL (expr) = stream_read_tree (ib, data_in);
} }
/* Read all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR /* Read all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR
......
...@@ -686,7 +686,9 @@ write_ts_type_common_tree_pointers (struct output_block *ob, tree expr, ...@@ -686,7 +686,9 @@ write_ts_type_common_tree_pointers (struct output_block *ob, tree expr,
stream_write_tree (ob, TYPE_CONTEXT (expr), ref_p); stream_write_tree (ob, TYPE_CONTEXT (expr), ref_p);
/* TYPE_CANONICAL is re-computed during type merging, so no need /* TYPE_CANONICAL is re-computed during type merging, so no need
to stream it here. */ to stream it here. */
stream_write_tree (ob, TYPE_STUB_DECL (expr), ref_p); /* Do not stream TYPE_STUB_DECL; it is not needed by LTO but currently
it can not be freed by free_lang_data without triggering ICEs in
langhooks. */
} }
/* Write all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR /* Write all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment