aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-11-22 00:59:49 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-11-21 23:59:49 +0000
commitf85d24870891e785a86e1c394ca559953b262d2d (patch)
tree8ce584973badca7655229ceeb55de6f4eed7e8d7 /gcc/tree.c
parentfeb391fc5d47f7bd3860fe192a7a73531cbde77f (diff)
downloadgcc-f85d24870891e785a86e1c394ca559953b262d2d.zip
gcc-f85d24870891e785a86e1c394ca559953b262d2d.tar.gz
gcc-f85d24870891e785a86e1c394ca559953b262d2d.tar.bz2
lto.c (iterative_hash_canonical_type): Always recurse for pointers.
* lto.c (iterative_hash_canonical_type): Always recurse for pointers. (gimple_register_canonical_type_1): Check that pointers do not get canonical types. (gimple_register_canonical_type): Do not register pointers. * tree.c (build_pointer_type_for_mode,build_reference_type_for_mode): In LTO we do not compute TYPE_CANONICAL of pointers. (gimple_canonical_types_compatible_p): Improve coments; sanity check that pointers do not have canonical type that would make us believe they are different. * alias.c (get_alias_set): Do structural type equality on pointers; enable pointer path for LTO; also glob pointer to vector with pointer to vector element; glob pointers and references for LTO; do more strict sanity checking about build_pointer_type returning the canonical type which is also the main variant. (record_component_aliases): When component type is pointer and we do LTO; record void_type_node alias set. From-SVN: r230715
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index d5a71a3..779fe93 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -7919,7 +7919,8 @@ build_pointer_type_for_mode (tree to_type, machine_mode mode,
TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (to_type);
TYPE_POINTER_TO (to_type) = t;
- if (TYPE_STRUCTURAL_EQUALITY_P (to_type))
+ /* During LTO we do not set TYPE_CANONICAL of pointers and references. */
+ if (TYPE_STRUCTURAL_EQUALITY_P (to_type) || in_lto_p)
SET_TYPE_STRUCTURAL_EQUALITY (t);
else if (TYPE_CANONICAL (to_type) != to_type || could_alias)
TYPE_CANONICAL (t)
@@ -7987,7 +7988,8 @@ build_reference_type_for_mode (tree to_type, machine_mode mode,
TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (to_type);
TYPE_REFERENCE_TO (to_type) = t;
- if (TYPE_STRUCTURAL_EQUALITY_P (to_type))
+ /* During LTO we do not set TYPE_CANONICAL of pointers and references. */
+ if (TYPE_STRUCTURAL_EQUALITY_P (to_type) || in_lto_p)
SET_TYPE_STRUCTURAL_EQUALITY (t);
else if (TYPE_CANONICAL (to_type) != to_type || could_alias)
TYPE_CANONICAL (t)
@@ -13224,7 +13226,9 @@ type_with_interoperable_signedness (const_tree type)
TBAA is concerned.
This function is used both by lto.c canonical type merging and by the
verifier. If TRUST_TYPE_CANONICAL we do not look into structure of types
- that have TYPE_CANONICAL defined and assume them equivalent. */
+ that have TYPE_CANONICAL defined and assume them equivalent. This is useful
+ only for LTO because only in these cases TYPE_CANONICAL equivalence
+ correspond to one defined by gimple_canonical_types_compatible_p. */
bool
gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
@@ -13265,9 +13269,19 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
|| (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. */
+
if (TYPE_CANONICAL (t1) && TYPE_CANONICAL (t2)
&& trust_type_canonical)
- return TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2);
+ {
+ /* Do not use TYPE_CANONICAL of pointer types. For LTO streamed types
+ they are always NULL, but they are set to non-NULL for types
+ constructed by build_pointer_type and variants. In this case the
+ TYPE_CANONICAL is more fine grained than the equivalnce we test (where
+ all pointers are considered equal. Be sure to not return false
+ negatives. */
+ gcc_checking_assert (!POINTER_TYPE_P (t1) && !POINTER_TYPE_P (t2));
+ return TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2);
+ }
/* 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));