summaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-11-18 13:10:40 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-11-18 13:10:40 +0000
commit1d85701e5c0d994f70230171c0edf4c5f992e705 (patch)
tree23e74f7d99d585498fab12d02608dd014e21b343 /gcc/gimple.c
parente36b9374164dac4af5e8076357414654f1b04459 (diff)
downloadgcc-1d85701e5c0d994f70230171c0edf4c5f992e705.tar.gz
re PR lto/46525 (Failed to bootstrap-lto)
2010-11-18 Richard Guenther <rguenther@suse.de> PR lto/46525 * gimple.c (gimple_register_type): Update TYPE_MAIN_VARIANT of type leaders. (gimple_register_canonical_type): Also cache the canoncial type for non type leaders. From-SVN: r166902
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 5f6b8d41c48..851e30ffbda 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -4283,6 +4283,7 @@ gimple_register_type (tree t)
{
void **slot;
gimple_type_leader_entry *leader;
+ tree mv_leader = NULL_TREE;
gcc_assert (TYPE_P (t));
@@ -4298,7 +4299,7 @@ gimple_register_type (tree t)
pick up the non-typedef variants as canonical, otherwise we'll end
up taking typedef ids for structure tags during comparison. */
if (TYPE_MAIN_VARIANT (t) != t)
- gimple_register_type (TYPE_MAIN_VARIANT (t));
+ mv_leader = gimple_register_type (TYPE_MAIN_VARIANT (t));
if (gimple_types == NULL)
gimple_types = htab_create_ggc (16381, gimple_type_hash, gimple_type_eq, 0);
@@ -4365,6 +4366,22 @@ gimple_register_type (tree t)
{
leader->type = t;
leader->leader = t;
+ /* We're the type leader. Make our TYPE_MAIN_VARIANT valid. */
+ if (TYPE_MAIN_VARIANT (t) != t
+ && TYPE_MAIN_VARIANT (t) != mv_leader)
+ {
+ /* Remove us from our main variant list as we are not the variant
+ leader and the variant leader will change. */
+ tree tem = TYPE_MAIN_VARIANT (t);
+ while (tem && TYPE_NEXT_VARIANT (tem) != t)
+ tem = TYPE_NEXT_VARIANT (tem);
+ if (tem)
+ TYPE_NEXT_VARIANT (tem) = TYPE_NEXT_VARIANT (t);
+ TYPE_NEXT_VARIANT (t) = NULL_TREE;
+ /* Adjust our main variant. Linking us into its variant list
+ will happen at fixup time. */
+ TYPE_MAIN_VARIANT (t) = mv_leader;
+ }
*slot = (void *) t;
}
@@ -4392,6 +4409,7 @@ tree
gimple_register_canonical_type (tree t)
{
void **slot;
+ tree orig_t = t;
gcc_assert (TYPE_P (t));
@@ -4427,6 +4445,9 @@ gimple_register_canonical_type (tree t)
*slot = (void *) t;
}
+ /* Also cache the canonical type in the non-leaders. */
+ TYPE_CANONICAL (orig_t) = t;
+
return t;
}