Commit 4d6eb35a by Jan Hubicka Committed by Jan Hubicka

ipa-devirt.c (type_in_anonymous_namespace_p): Return true or implicit declarations.


	* ipa-devirt.c (type_in_anonymous_namespace_p): Return true
	or implicit declarations.
	(odr_type_p): Check that TYPE_NAME is TYPE_DECL before looking
	into it.
	(get_odr_type): Check type has linkage before adding bases.
	(register_odr_type): Check that type has linkage before adding it.
	(type_known_to_have_no_deriavations_p): Rename to ..
	(type_known_to_have_no_derivations_p): This one.
	* ipa-utils.h (type_known_to_have_no_deriavations_p): Rename to ..
	(type_known_to_have_no_derivations_p): This one.
	* ipa-polymorphic-call.c
	(ipa_polymorphic_call_context::restrict_to_inner_type): Check that
	type has linkage.

From-SVN: r223415
parent 296a8c2f
2015-05-19 Jan Hubicka <hubicka@ucw.cz>
* ipa-devirt.c (type_in_anonymous_namespace_p): Return true
or implicit declarations.
(odr_type_p): Check that TYPE_NAME is TYPE_DECL before looking
into it.
(get_odr_type): Check type has linkage before adding bases.
(register_odr_type): Check that type has linkage before adding it.
(type_known_to_have_no_deriavations_p): Rename to ..
(type_known_to_have_no_derivations_p): This one.
* ipa-utils.h (type_known_to_have_no_deriavations_p): Rename to ..
(type_known_to_have_no_derivations_p): This one.
* ipa-polymorphic-call.c
(ipa_polymorphic_call_context::restrict_to_inner_type): Check that
type has linkage.
2015-05-19 Eric Botcazou <ebotcazou@adacore.com> 2015-05-19 Eric Botcazou <ebotcazou@adacore.com>
* stor-layout.c (finalize_type_size): Use AGGREGATE_TYPE_P. * stor-layout.c (finalize_type_size): Use AGGREGATE_TYPE_P.
......
...@@ -269,6 +269,8 @@ type_in_anonymous_namespace_p (const_tree t) ...@@ -269,6 +269,8 @@ type_in_anonymous_namespace_p (const_tree t)
if (TYPE_STUB_DECL (t) && !TREE_PUBLIC (TYPE_STUB_DECL (t))) if (TYPE_STUB_DECL (t) && !TREE_PUBLIC (TYPE_STUB_DECL (t)))
{ {
if (DECL_ARTIFICIAL (TYPE_NAME (t)))
return true;
tree ctx = DECL_CONTEXT (TYPE_NAME (t)); tree ctx = DECL_CONTEXT (TYPE_NAME (t));
while (ctx) while (ctx)
{ {
...@@ -296,7 +298,7 @@ odr_type_p (const_tree t) ...@@ -296,7 +298,7 @@ odr_type_p (const_tree t)
to care, since it is used only for type merging. */ to care, since it is used only for type merging. */
gcc_checking_assert (in_lto_p || flag_lto); gcc_checking_assert (in_lto_p || flag_lto);
return (TYPE_NAME (t) return (TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL
&& (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)))); && (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t))));
} }
...@@ -2124,6 +2126,7 @@ get_odr_type (tree type, bool insert) ...@@ -2124,6 +2126,7 @@ get_odr_type (tree type, bool insert)
} }
if (build_bases && TREE_CODE (type) == RECORD_TYPE && TYPE_BINFO (type) if (build_bases && TREE_CODE (type) == RECORD_TYPE && TYPE_BINFO (type)
&& type_with_linkage_p (type)
&& type == TYPE_MAIN_VARIANT (type)) && type == TYPE_MAIN_VARIANT (type))
{ {
tree binfo = TYPE_BINFO (type); tree binfo = TYPE_BINFO (type);
...@@ -2183,7 +2186,8 @@ register_odr_type (tree type) ...@@ -2183,7 +2186,8 @@ register_odr_type (tree type)
makes it possible that non-ODR type is main_odr_variant of ODR type. makes it possible that non-ODR type is main_odr_variant of ODR type.
Things may get smoother if LTO FE set mangled name of those types same Things may get smoother if LTO FE set mangled name of those types same
way as C++ FE does. */ way as C++ FE does. */
if (odr_type_p (main_odr_variant (TYPE_MAIN_VARIANT (type)))) if (odr_type_p (main_odr_variant (TYPE_MAIN_VARIANT (type)))
&& odr_type_p (TYPE_MAIN_VARIANT (type)))
get_odr_type (TYPE_MAIN_VARIANT (type), true); get_odr_type (TYPE_MAIN_VARIANT (type), true);
if (TYPE_MAIN_VARIANT (type) != type && odr_type_p (main_odr_variant (type))) if (TYPE_MAIN_VARIANT (type) != type && odr_type_p (main_odr_variant (type)))
get_odr_type (type, true); get_odr_type (type, true);
...@@ -2192,7 +2196,7 @@ register_odr_type (tree type) ...@@ -2192,7 +2196,7 @@ register_odr_type (tree type)
/* Return true if type is known to have no derivations. */ /* Return true if type is known to have no derivations. */
bool bool
type_known_to_have_no_deriavations_p (tree t) type_known_to_have_no_derivations_p (tree t)
{ {
return (type_all_derivations_known_p (t) return (type_all_derivations_known_p (t)
&& (TYPE_FINAL_P (t) && (TYPE_FINAL_P (t)
......
...@@ -269,7 +269,8 @@ ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type, ...@@ -269,7 +269,8 @@ ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type,
types. Testing it here may help us to avoid speculation. */ types. Testing it here may help us to avoid speculation. */
if (otr_type && TREE_CODE (outer_type) == RECORD_TYPE if (otr_type && TREE_CODE (outer_type) == RECORD_TYPE
&& (!in_lto_p || odr_type_p (outer_type)) && (!in_lto_p || odr_type_p (outer_type))
&& type_known_to_have_no_deriavations_p (outer_type)) && type_with_linkage_p (outer_type)
&& type_known_to_have_no_derivations_p (outer_type))
maybe_derived_type = false; maybe_derived_type = false;
/* Type can not contain itself on an non-zero offset. In that case /* Type can not contain itself on an non-zero offset. In that case
...@@ -393,7 +394,7 @@ ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type, ...@@ -393,7 +394,7 @@ ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type,
goto no_useful_type_info; goto no_useful_type_info;
cur_offset = new_offset; cur_offset = new_offset;
type = subtype; type = TYPE_MAIN_VARIANT (subtype);
if (!speculative) if (!speculative)
{ {
outer_type = type; outer_type = type;
......
...@@ -80,7 +80,7 @@ bool vtable_pointer_value_to_vtable (const_tree, tree *, unsigned HOST_WIDE_INT ...@@ -80,7 +80,7 @@ bool vtable_pointer_value_to_vtable (const_tree, tree *, unsigned HOST_WIDE_INT
tree subbinfo_with_vtable_at_offset (tree, unsigned HOST_WIDE_INT, tree); tree subbinfo_with_vtable_at_offset (tree, unsigned HOST_WIDE_INT, tree);
void compare_virtual_tables (varpool_node *, varpool_node *); void compare_virtual_tables (varpool_node *, varpool_node *);
bool type_all_derivations_known_p (const_tree); bool type_all_derivations_known_p (const_tree);
bool type_known_to_have_no_deriavations_p (tree); bool type_known_to_have_no_derivations_p (tree);
bool contains_polymorphic_type_p (const_tree); bool contains_polymorphic_type_p (const_tree);
void register_odr_type (tree); void register_odr_type (tree);
bool types_must_be_same_for_odr (tree, tree); bool types_must_be_same_for_odr (tree, tree);
......
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