summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-11 23:16:42 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-11 23:16:42 +0000
commitd585ba22a6b4250b0d819d3d7da72f7dd37e2981 (patch)
tree5ca60267bac44557141301c497a4c5364a3466f9 /gcc/tree.c
parentf2225dc8ebf68a940551bb295e956eb88fb01b81 (diff)
downloadgcc-d585ba22a6b4250b0d819d3d7da72f7dd37e2981.tar.gz
* common.opt (flto-odr-type-merging): New flag.
* ipa-deivrt.c (hash_type_name): Use ODR names for hasing if availale. (types_same_for_odr): Likewise. (odr_subtypes_equivalent_p): Likewise. (add_type_duplicate): Do not walk type variants. (register_odr_type): New function. * ipa-utils.h (register_odr_type): Declare. (odr_type_p): New function. * langhooks.c (lhd_set_decl_assembler_name): Do not compute TYPE_DECLs * doc/invoke.texi (-flto-odr-type-merging): Document. * tree.c (need_assembler_name_p): Compute ODR names when asked for it. * tree.h (DECL_ASSEMBLER_NAME): Update comment. * lto.c (lto_read_decls): Register ODR types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215196 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index d1d67efa629..e40ee23e1e3 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4980,6 +4980,15 @@ free_lang_data_in_type (tree type)
static inline bool
need_assembler_name_p (tree decl)
{
+ /* We use DECL_ASSEMBLER_NAME to hold mangled type names for One Definition Rule
+ merging. */
+ if (flag_lto_odr_type_mering
+ && TREE_CODE (decl) == TYPE_DECL
+ && DECL_NAME (decl)
+ && decl == TYPE_NAME (TREE_TYPE (decl))
+ && !is_lang_specific (TREE_TYPE (decl))
+ && !type_in_anonymous_namespace_p (TREE_TYPE (decl)))
+ return !DECL_ASSEMBLER_NAME_SET_P (decl);
/* Only FUNCTION_DECLs and VAR_DECLs are considered. */
if (TREE_CODE (decl) != FUNCTION_DECL
&& TREE_CODE (decl) != VAR_DECL)