This is the last (planned) bit for the regular type merging machinery
(there is still some issues with TYPE_CANONICAL that I will try to
address next).  It avoids merging types which have different names
as that leads to interesting debuginfo issues.

LTO-bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC 2k6
non--g built (w/o any but the TYPE_CANONICAL issues), SPEC 2k6 -g
build running.

Richard.

2011-05-23  Richard Guenther  <rguent...@suse.de>

        * gimple.c (gimple_types_compatible_p_1): Always compare type names.
        (iterative_hash_gimple_type): Always hash type names.

Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c        (revision 174065)
--- gcc/gimple.c        (working copy)
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3587,3592 ****
--- 3587,3596 ----
       SCCs this assumption may get revisited.  */
    state->u.same_p = 1;
  
+   /* The struct tags shall compare equal.  */
+   if (!compare_type_names_p (t1, t2, false))
+     goto different_types;
+ 
    /* If their attributes are not the same they can't be the same type.  */
    if (!attribute_list_equal (TYPE_ATTRIBUTES (t1), TYPE_ATTRIBUTES (t2)))
      goto different_types;
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3797,3806 ****
        {
        tree f1, f2;
  
-       /* The struct tags shall compare equal.  */
-       if (!compare_type_names_p (t1, t2, false))
-         goto different_types;
- 
        /* For aggregate types, all the fields must be the same.  */
        for (f1 = TYPE_FIELDS (t1), f2 = TYPE_FIELDS (t2);
             f1 && f2;
--- 3801,3806 ----
*************** iterative_hash_gimple_type (tree type, h
*** 4093,4099 ****
       smaller sets; when searching for existing matching types to merge,
       only existing types having the same features as the new type will be
       checked.  */
!   v = iterative_hash_hashval_t (TREE_CODE (type), 0);
    v = iterative_hash_hashval_t (TYPE_QUALS (type), v);
    v = iterative_hash_hashval_t (TREE_ADDRESSABLE (type), v);
  
--- 4093,4100 ----
       smaller sets; when searching for existing matching types to merge,
       only existing types having the same features as the new type will be
       checked.  */
!   v = iterative_hash_name (TYPE_NAME (type), 0);
!   v = iterative_hash_hashval_t (TREE_CODE (type), v);
    v = iterative_hash_hashval_t (TYPE_QUALS (type), v);
    v = iterative_hash_hashval_t (TREE_ADDRESSABLE (type), v);
  
*************** iterative_hash_gimple_type (tree type, h
*** 4175,4182 ****
        unsigned nf;
        tree f;
  
-       v = iterative_hash_name (TYPE_NAME (type), v);
- 
        for (f = TYPE_FIELDS (type), nf = 0; f; f = TREE_CHAIN (f))
        {
          v = iterative_hash_name (DECL_NAME (f), v);
--- 4176,4181 ----

Reply via email to