From 9da647695f3c67e69cf15db31be31031b0bf05d6 Mon Sep 17 00:00:00 2001 From: hubicka Date: Thu, 30 Apr 2015 04:43:32 +0000 Subject: [PATCH] * ipa-devirt.c (odr_subtypes_equivalent_p): Compare TYPE_NAME only for aggregate types. (register_odr_type): Be ready for MAIN_VARIANT of ODR type type to be non_ODR. * tree.c (need_assembler_name_p): Compute mangled name for non-fundamental types and integer types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222609 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/ipa-devirt.c | 13 +++++++++---- gcc/tree.c | 12 +++++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c7558a82f3..071c12db71a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-04-29 Jan Hubicka + + * ipa-devirt.c (odr_subtypes_equivalent_p): Compare TYPE_NAME only + for aggregate types. + (register_odr_type): Be ready for MAIN_VARIANT of ODR type + type to be non_ODR. + * tree.c (need_assembler_name_p): Compute mangled name for + non-fundamental types and integer types. + 2015-04-29 Mikhail Maltsev * dojump.c (do_compare_rtx_and_jump): Use std::swap instead of diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 7214a74b8e8..aacc59cf7a1 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -675,7 +675,8 @@ odr_subtypes_equivalent_p (tree t1, tree t2, have to be compared structurally. */ if (TREE_CODE (t1) != TREE_CODE (t2)) return false; - if ((TYPE_NAME (t1) == NULL_TREE) != (TYPE_NAME (t2) == NULL_TREE)) + if (AGGREGATE_TYPE_P (t1) + && (TYPE_NAME (t1) == NULL_TREE) != (TYPE_NAME (t2) == NULL_TREE)) return false; type_pair pair={t1,t2}; @@ -2029,10 +2030,14 @@ register_odr_type (tree type) if (in_lto_p) odr_vtable_hash = new odr_vtable_hash_type (23); } - /* Arrange things to be nicer and insert main variants first. */ - if (odr_type_p (TYPE_MAIN_VARIANT (type))) + /* Arrange things to be nicer and insert main variants first. + ??? fundamental prerecorded types do not have mangled names; this + 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)))) get_odr_type (TYPE_MAIN_VARIANT (type), true); - if (TYPE_MAIN_VARIANT (type) != type) + if (TYPE_MAIN_VARIANT (type) != type && odr_type_p (main_odr_variant (type))) get_odr_type (type, true); } diff --git a/gcc/tree.c b/gcc/tree.c index 31a275e0589..15d94a3f3f4 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5145,7 +5145,17 @@ need_assembler_name_p (tree decl) && DECL_NAME (decl) && decl == TYPE_NAME (TREE_TYPE (decl)) && !is_lang_specific (TREE_TYPE (decl)) - && AGGREGATE_TYPE_P (TREE_TYPE (decl)) + /* Save some work. Names of builtin types are always derived from + properties of its main variant. A special case are integer types + where mangling do make differences between char/signed char/unsigned + char etc. Storing name for these makes e.g. + -fno-signed-char/-fsigned-char mismatches to be handled well. + + See cp/mangle.c:write_builtin_type for details. */ + && (TREE_CODE (TREE_TYPE (decl)) != VOID_TYPE + && TREE_CODE (TREE_TYPE (decl)) != BOOLEAN_TYPE + && TREE_CODE (TREE_TYPE (decl)) != REAL_TYPE + && TREE_CODE (TREE_TYPE (decl)) != FIXED_POINT_TYPE) && !TYPE_ARTIFICIAL (TREE_TYPE (decl)) && !variably_modified_type_p (TREE_TYPE (decl), NULL_TREE) && !type_in_anonymous_namespace_p (TREE_TYPE (decl))) -- 2.11.4.GIT