aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimple.c23
2 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2169780..3e589d2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
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.
+
+2010-11-18 Richard Guenther <rguenther@suse.de>
+
* lto-wrapper.c (run_gcc): Fix -flto=N parsing.
2010-11-18 Alexander Monakov <amonakov@ispras.ru>
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 5f6b8d4..851e30f 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;
}