diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2015-06-04 01:13:49 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-06-03 23:13:49 +0000 |
commit | 93e2aa6d4599866c8be24131914512dfd8c31de2 (patch) | |
tree | de7a5c9a9e666510f95a3f68ca8db557f286982f /gcc | |
parent | 1cc1ac7f375c34bbd7ae1605c6fc3ff37ebaa8a4 (diff) | |
download | gcc-93e2aa6d4599866c8be24131914512dfd8c31de2.zip gcc-93e2aa6d4599866c8be24131914512dfd8c31de2.tar.gz gcc-93e2aa6d4599866c8be24131914512dfd8c31de2.tar.bz2 |
lto.c (iterative_hash_canonical_type, [...]): only hash main variants of types
* lto.c (iterative_hash_canonical_type,
gimple_register_canonical_type): only hash main variants of types
* tree.c (verify_type_variant): Verify that type and variant is
compatible.
(gimple_canonical_types_compatible_p): Look for main variants.
From-SVN: r224107
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/lto/lto.c | 13 | ||||
-rw-r--r-- | gcc/tree.c | 19 |
4 files changed, 41 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2124e52..948abe5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-06-03 Jan Hubicka <hubicka@ucw.cz> + + * tree.c (verify_type_variant): Verify that type and variant is + compatible. + (gimple_canonical_types_compatible_p): Look for main variants. + 2015-06-03 Michael Meissner <meissner@linux.vnet.ibm.com> * config.gcc (powerpc*-*-*): Add support for a new configure diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 6e27922..db0214b 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,8 @@ +2015-06-03 Jan Hubicka <hubicka@ucw.cz> + + * lto.c (iterative_hash_canonical_type, + gimple_register_canonical_type): only hash main variants of types + 2015-05-27 Martin Liska <mliska@suse.cz> * lto-partition.c (new_partition): Reset number of symbols. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 169b025..75774a1 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -413,6 +413,9 @@ static void iterative_hash_canonical_type (tree type, inchash::hash &hstate) { hashval_t v; + + /* All type variants have same TYPE_CANONICAL. */ + type = TYPE_MAIN_VARIANT (type); /* An already processed type. */ if (TYPE_CANONICAL (type)) { @@ -498,7 +501,15 @@ gimple_register_canonical_type (tree t) if (TYPE_CANONICAL (t) || !type_with_alias_set_p (t)) return; - gimple_register_canonical_type_1 (t, hash_canonical_type (t)); + /* Canonical types are same among all complete variants. */ + if (TYPE_CANONICAL (TYPE_MAIN_VARIANT (t))) + TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t)); + else + { + gimple_register_canonical_type_1 (TYPE_MAIN_VARIANT (t), + hash_canonical_type (TYPE_MAIN_VARIANT (t))); + TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t)); + } } /* Re-compute TYPE_CANONICAL for NODE and related types. */ @@ -12855,6 +12855,17 @@ verify_type_variant (const_tree t, tree tv) debug_tree (TREE_TYPE (t)); return false; } + if (type_with_alias_set_p (t) + && !gimple_canonical_types_compatible_p (t, tv, false)) + { + error ("type is not compatible with its vairant"); + debug_tree (tv); + error ("type variant's TREE_TYPE"); + debug_tree (TREE_TYPE (tv)); + error ("type's TREE_TYPE"); + debug_tree (TREE_TYPE (t)); + return false; + } return true; #undef verify_variant_match } @@ -12879,7 +12890,13 @@ bool gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, bool trust_type_canonical) { - /* Before starting to set up the SCC machinery handle simple cases. */ + /* Type variants should be same as the main variant. When not doing sanity + checking to verify this fact, go to main variants and save some work. */ + if (trust_type_canonical) + { + t1 = TYPE_MAIN_VARIANT (t1); + t2 = TYPE_MAIN_VARIANT (t2); + } /* Check first for the obvious case of pointer identity. */ if (t1 == t2) |