re PR middle-end/48849 (SPEC CPU 2000/2006 failed to build with LTO)
authorRichard Guenther <rguenther@suse.de>
Fri, 20 May 2011 09:35:44 +0000 (09:35 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 20 May 2011 09:35:44 +0000 (09:35 +0000)
2011-05-20  Richard Guenther  <rguenther@suse.de>

PR middle-end/48849
* gimple.c (gimple_register_canonical_type): Compute TYPE_CANONICAL
of pointer types the same way the middle-end does.

From-SVN: r173939

gcc/ChangeLog
gcc/gimple.c

index b89b3f9a0b1cec9a0ca52069bfaad152e63254d3..3bd18b854b8fe078e4ca6af38c4a305e4f68b2f7 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-20  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/48849
+       * gimple.c (gimple_register_canonical_type): Compute TYPE_CANONICAL
+       of pointer types the same way the middle-end does.
+
 2011-05-20  Richard Guenther  <rguenther@suse.de>
 
        * gimple.c (gimple_register_type_1): Do not fiddle with
index 5b03e15a1fc2206f855d108f12fa18e9d120be8f..4c7fbfc8235efb65d431f90e2b5ede7699bd4051 100644 (file)
@@ -4801,6 +4801,25 @@ gimple_register_canonical_type (tree t)
   if (TYPE_CANONICAL (t))
     return TYPE_CANONICAL (t);
 
+  /* For pointer and reference types do as the middle-end does - the
+     canonical type is a pointer to the canonical pointed-to type.  */
+  if (TREE_CODE (t) == POINTER_TYPE)
+    {
+      TYPE_CANONICAL (t)
+         = build_pointer_type_for_mode
+         (gimple_register_canonical_type (TREE_TYPE (t)),
+          TYPE_MODE (t), TYPE_REF_CAN_ALIAS_ALL (t));
+      return TYPE_CANONICAL (t);
+    }
+  else if (TREE_CODE (t) == REFERENCE_TYPE)
+    {
+      TYPE_CANONICAL (t)
+         = build_reference_type_for_mode
+         (gimple_register_canonical_type (TREE_TYPE (t)),
+          TYPE_MODE (t), TYPE_REF_CAN_ALIAS_ALL (t));
+      return TYPE_CANONICAL (t);
+    }
+
   if (gimple_canonical_types == NULL)
     gimple_canonical_types = htab_create_ggc (16381, gimple_canonical_type_hash,
                                              gimple_canonical_type_eq, 0);