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
This commit is contained in:
Jan Hubicka 2015-05-19 23:02:06 +02:00 committed by Jan Hubicka
parent 296a8c2f54
commit 4d6eb35a6d
4 changed files with 27 additions and 6 deletions

View File

@ -1,3 +1,19 @@
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>
* stor-layout.c (finalize_type_size): Use AGGREGATE_TYPE_P.

View File

@ -269,6 +269,8 @@ type_in_anonymous_namespace_p (const_tree 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));
while (ctx)
{
@ -296,7 +298,7 @@ odr_type_p (const_tree t)
to care, since it is used only for type merging. */
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))));
}
@ -2124,6 +2126,7 @@ get_odr_type (tree type, bool insert)
}
if (build_bases && TREE_CODE (type) == RECORD_TYPE && TYPE_BINFO (type)
&& type_with_linkage_p (type)
&& type == TYPE_MAIN_VARIANT (type))
{
tree binfo = TYPE_BINFO (type);
@ -2183,7 +2186,8 @@ register_odr_type (tree 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
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);
if (TYPE_MAIN_VARIANT (type) != type && odr_type_p (main_odr_variant (type)))
get_odr_type (type, true);
@ -2192,7 +2196,7 @@ register_odr_type (tree type)
/* Return true if type is known to have no derivations. */
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)
&& (TYPE_FINAL_P (t)

View File

@ -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. */
if (otr_type && TREE_CODE (outer_type) == RECORD_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;
/* 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,
goto no_useful_type_info;
cur_offset = new_offset;
type = subtype;
type = TYPE_MAIN_VARIANT (subtype);
if (!speculative)
{
outer_type = type;

View File

@ -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);
void compare_virtual_tables (varpool_node *, varpool_node *);
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);
void register_odr_type (tree);
bool types_must_be_same_for_odr (tree, tree);