Commit 420672bc by Jan Hubicka Committed by Jan Hubicka

ipa-devirt.c (warn_odr): Make static.


	* ipa-devirt.c (warn_odr): Make static.
	(types_same_for_odr): Drop strict variant.
	(types_odr_comparable): Likewise.
	(odr_or_derived_type_p): Look for main variants.
	(odr_name_hasher::equal): Cleanup comment.
	(odr_subtypes_equivalent): Add warn and warned arguments; check main
	variants.
	(type_variants_equivalent_p): break out from ...
	(odr_types_equivalent): ... here; go for main variants where needed.
	(warn_odr): ... here; turn static.
	(warn_types_mismatch): Compare mangled names of main variants.
	* ipa-utils.h (types_odr_comparable): Drop strict parameter.
	(type_with_linkage_p): Sanity check that we look at main variant.
	* lto.c (lto_read_decls): Only consider main variant to be ODR type.
	* tree.h (types_same_for_odr): Drop strict argument.

From-SVN: r265519
parent 99976e27
2018-10-26 Jan Hubicka <jh@suse.cz>
* ipa-devirt.c (warn_odr): Make static.
(types_same_for_odr): Drop strict variant.
(types_odr_comparable): Likewise.
(odr_or_derived_type_p): Look for main variants.
(odr_name_hasher::equal): Cleanup comment.
(odr_subtypes_equivalent): Add warn and warned arguments; check main
variants.
(type_variants_equivalent_p): break out from ...
(odr_types_equivalent): ... here; go for main variants where needed.
(warn_odr): ... here; turn static.
(warn_types_mismatch): Compare mangled names of main variants.
* ipa-utils.h (types_odr_comparable): Drop strict parameter.
(type_with_linkage_p): Sanity check that we look at main variant.
* lto.c (lto_read_decls): Only consider main variant to be ODR type.
* tree.h (types_same_for_odr): Drop strict argument.
2018-10-26 Richard Biener <rguenther@suse.de> 2018-10-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/87746 PR tree-optimization/87746
...@@ -83,7 +83,7 @@ bool type_known_to_have_no_derivations_p (tree); ...@@ -83,7 +83,7 @@ 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);
bool types_odr_comparable (tree, tree, bool strict = false); bool types_odr_comparable (tree, tree);
cgraph_node *try_speculative_devirtualization (tree, HOST_WIDE_INT, cgraph_node *try_speculative_devirtualization (tree, HOST_WIDE_INT,
ipa_polymorphic_call_context); ipa_polymorphic_call_context);
void warn_types_mismatch (tree t1, tree t2, location_t loc1 = UNKNOWN_LOCATION, void warn_types_mismatch (tree t1, tree t2, location_t loc1 = UNKNOWN_LOCATION,
...@@ -179,6 +179,7 @@ polymorphic_type_binfo_p (const_tree binfo) ...@@ -179,6 +179,7 @@ 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)
{ {
gcc_checking_assert (TYPE_MAIN_VARIANT (t) == t);
if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL) if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL)
return false; return false;
......
...@@ -1827,7 +1827,7 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data, ...@@ -1827,7 +1827,7 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
type canonical of a derived type in the same SCC. */ type canonical of a derived type in the same SCC. */
if (!TYPE_CANONICAL (t)) if (!TYPE_CANONICAL (t))
gimple_register_canonical_type (t); gimple_register_canonical_type (t);
if (odr_type_p (t)) if (TYPE_MAIN_VARIANT (t) == t && odr_type_p (t))
odr_types.safe_push (t); odr_types.safe_push (t);
} }
/* Link shared INTEGER_CSTs into TYPE_CACHED_VALUEs of its /* Link shared INTEGER_CSTs into TYPE_CACHED_VALUEs of its
......
...@@ -4958,8 +4958,7 @@ extern tree block_ultimate_origin (const_tree); ...@@ -4958,8 +4958,7 @@ extern tree block_ultimate_origin (const_tree);
extern tree get_binfo_at_offset (tree, poly_int64, tree); extern tree get_binfo_at_offset (tree, poly_int64, tree);
extern bool virtual_method_call_p (const_tree); extern bool virtual_method_call_p (const_tree);
extern tree obj_type_ref_class (const_tree ref); extern tree obj_type_ref_class (const_tree ref);
extern bool types_same_for_odr (const_tree type1, const_tree type2, extern bool types_same_for_odr (const_tree type1, const_tree type2);
bool strict=false);
extern bool contains_bitfld_component_ref_p (const_tree); extern bool contains_bitfld_component_ref_p (const_tree);
extern bool block_may_fallthru (const_tree); extern bool block_may_fallthru (const_tree);
extern void using_eh_for_cleanups (void); extern void using_eh_for_cleanups (void);
......
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