diff options
author | Jan Hubicka <jh@suse.cz> | 2019-06-27 14:07:43 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2019-06-27 12:07:43 +0000 |
commit | a0276c00934da47fa511aa52e1973b68ffd8b2ab (patch) | |
tree | 665e4f690d6caafce10b0ade27ecfeef5909742f /gcc/tree.c | |
parent | ef874db611879d5004e1d834543e55d31f2bfe1c (diff) | |
download | gcc-a0276c00934da47fa511aa52e1973b68ffd8b2ab.zip gcc-a0276c00934da47fa511aa52e1973b68ffd8b2ab.tar.gz gcc-a0276c00934da47fa511aa52e1973b68ffd8b2ab.tar.bz2 |
class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base type copy.
* class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
type copy.
* ipa-devirt.c (odr_type_d): Add tbaa_enabled flag.
(add_type_duplicate): When odr hash is not allocated, to nothing.
(odr_based_tbaa_p): New function.
(set_type_canonical_for_odr_type): New function.
* ipa-utils.h (enable_odr_based_tbaa, odr_based_tbaa_p,
set_type_canonical_for_odr_type): New.
* tree.c (gimple_canonical_types_compatible_p): ODR types with
ODR based TBAA are not equivalent to non-ODR types.
* lto-common.c: Include demangle.h and tree-pretty-print.h
(type_streaming_finished): New static var.
(gimple_register_canonical_type_1): Return updated hash; handle ODR
types.
(iterative_hash_canonical_type): Update use of
gimple_register_canonical_type_1.
* g++.dg/lto/alias-2_0.C: New testcase.
* g++.dg/lto/alias-2_1.C: New testcase.
From-SVN: r272749
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -14101,6 +14101,7 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, gcc_assert (!trust_type_canonical || (type_with_alias_set_p (t1) && type_with_alias_set_p (t2))); + /* If the types have been previously registered and found equal they still are. */ @@ -14118,6 +14119,14 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, return TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2); } + /* For types where we do ODR based TBAA the canonical type is always + set correctly, so we know that types are different if their + canonical types does not match. */ + if (trust_type_canonical + && (odr_type_p (t1) && odr_based_tbaa_p (t1)) + != (odr_type_p (t2) && odr_based_tbaa_p (t2))) + return false; + /* Can't be the same type if the types don't have the same code. */ enum tree_code code = tree_code_for_canonical_type_merging (TREE_CODE (t1)); if (code != tree_code_for_canonical_type_merging (TREE_CODE (t2))) |