summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-19 10:31:23 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-19 10:31:23 +0000
commitbddb37639dd332492a524ea28da9aa34cf1a2903 (patch)
tree33bf9f864a99e5d23f72adbcd38ea97726d8ff2b
parent01bbe5aaf5cf92b9f4e235dbe0fe91b5f903f679 (diff)
downloadgcc-bddb37639dd332492a524ea28da9aa34cf1a2903.tar.gz
2011-05-19 Richard Guenther <rguenther@suse.de>
* gimple.c (gimple_types_compatible_p_1): Compare names of the types themselves. (iterative_hash_gimple_type): And hash them that way. (gimple_register_type_1): If we register a main variant properly initialize the leader to ourselves. lto/ * lto.c (uniquify_nodes): First register all types before fixing up the tree SCC. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173900 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimple.c14
-rw-r--r--gcc/lto/ChangeLog5
-rw-r--r--gcc/lto/lto.c14
4 files changed, 36 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a22cc926bdd..a653ae8442f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2011-05-19 Richard Guenther <rguenther@suse.de>
+
+ * gimple.c (gimple_types_compatible_p_1): Compare names of
+ the types themselves.
+ (iterative_hash_gimple_type): And hash them that way.
+ (gimple_register_type_1): If we register a main variant properly
+ initialize the leader to ourselves.
+
2011-05-19 Tom de Vries <tom@codesourcery.com>
PR target/45098
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 3bf369add07..e4c318f9e8a 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -3824,8 +3824,7 @@ gimple_types_compatible_p_1 (tree t1, tree t2, type_pair_t p,
tree f1, f2;
/* The struct tags shall compare equal. */
- if (!compare_type_names_p (TYPE_MAIN_VARIANT (t1),
- TYPE_MAIN_VARIANT (t2), false))
+ if (!compare_type_names_p (t1, t2, false))
goto different_types;
/* For aggregate types, all the fields must be the same. */
@@ -4202,7 +4201,7 @@ iterative_hash_gimple_type (tree type, hashval_t val,
unsigned nf;
tree f;
- v = iterative_hash_name (TYPE_NAME (TYPE_MAIN_VARIANT (type)), v);
+ v = iterative_hash_name (TYPE_NAME (type), v);
for (f = TYPE_FIELDS (type), nf = 0; f; f = TREE_CHAIN (f))
{
@@ -4503,7 +4502,7 @@ gimple_register_type_1 (tree t, bool registering_mv)
{
void **slot;
gimple_type_leader_entry *leader;
- tree mv_leader = NULL_TREE;
+ tree mv_leader;
/* If we registered this type before return the cached result. */
leader = &gimple_type_leader[TYPE_UID (t) % GIMPLE_TYPE_LEADER_SIZE];
@@ -4516,10 +4515,15 @@ gimple_register_type_1 (tree t, bool registering_mv)
It also makes sure that main variants will be merged to main variants.
As we are operating on a possibly partially fixed up type graph
do not bother to recurse more than once, otherwise we may end up
- walking in circles. */
+ walking in circles.
+ If we are registering a main variant it will either remain its
+ own main variant or it will be merged to something else in which
+ case we do not care for the main variant leader. */
if (!registering_mv
&& TYPE_MAIN_VARIANT (t) != t)
mv_leader = gimple_register_type_1 (TYPE_MAIN_VARIANT (t), true);
+ else
+ mv_leader = t;
slot = htab_find_slot (gimple_types, t, INSERT);
if (*slot
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 7f10bfbf7ae..79e0146694d 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-19 Richard Guenther <rguenther@suse.de>
+
+ * lto.c (uniquify_nodes): First register all types before
+ fixing up the tree SCC.
+
2011-05-11 Jan Hubicka <jh@suse.cz>
PR lto/48952
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index ce72711f99f..67e080f8389 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -605,6 +605,20 @@ uniquify_nodes (struct data_in *data_in, unsigned from)
struct lto_streamer_cache_d *cache = data_in->reader_cache;
unsigned len = VEC_length (tree, cache->nodes);
unsigned i;
+
+ /* Go backwards because childs streamed for the first time come
+ as part of their parents, and hence are created after them. */
+ for (i = len; i-- > from;)
+ {
+ tree t = VEC_index (tree, cache->nodes, i);
+ if (!t)
+ continue;
+
+ /* Now try to find a canonical variant of T itself. */
+ if (TYPE_P (t))
+ gimple_register_type (t);
+ }
+
/* Go backwards because childs streamed for the first time come
as part of their parents, and hence are created after them. */
for (i = len; i-- > from;)