diff mbox

Fix PR45586

Message ID 20140109085317.35A6D104@mailhost.lps.ens.fr
State New
Headers show

Commit Message

Dominique d'Humières Jan. 9, 2014, 8:53 a.m. UTC
> This fixes the gimple verification ICEs in the Fortran testsuite.
> ...

This patch causes 6300+ regressions (-m32/-m64 all languages but go).
However the following change


fixes PR45586 without regression. Further testing is blocked by
PR59723.

Dominique

Comments

Richard Biener Jan. 9, 2014, 11:48 a.m. UTC | #1
On Thu, 9 Jan 2014, Dominique Dhumieres wrote:

> > This fixes the gimple verification ICEs in the Fortran testsuite.
> > ...
> 
> This patch causes 6300+ regressions (-m32/-m64 all languages but go).
> However the following change
> 
> --- ../_clean/gcc/lto/lto.c	2014-01-04 15:51:44.000000000 +0100
> +++ gcc/lto/lto.c	2014-01-08 08:26:09.000000000 +0100
> @@ -310,7 +310,7 @@ hash_canonical_type (tree type)
>      {
>        v = iterative_hash_hashval_t (TYPE_REF_CAN_ALIAS_ALL (type), v);
>        v = iterative_hash_hashval_t (TYPE_ADDR_SPACE (TREE_TYPE (type)), v);
> -      v = iterative_hash_hashval_t (TYPE_RESTRICT (type), v);
> +      /* v = iterative_hash_hashval_t (TYPE_RESTRICT (type), v); */
>        v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v);
>      }
>  
> @@ -495,8 +495,8 @@ gimple_canonical_types_compatible_p (tre
>  	      != TYPE_ADDR_SPACE (TREE_TYPE (t2)))
>  	    return false;
>  
> -	  if (TYPE_RESTRICT (t1) != TYPE_RESTRICT (t2))
> -	    return false;
> +	  /* if (TYPE_RESTRICT (t1) != TYPE_RESTRICT (t2))
> +	    return false; */
>  
>  	  if (TREE_CODE (TREE_TYPE (t1)) != TREE_CODE (TREE_TYPE (t2)))
>  	    return false;
> 
> fixes PR45586 without regression. Further testing is blocked by
> PR59723.

Yeah.  I've tried to look at the fallout but got stuck with inappropriate
changes for stage3.  So I've settled for the following which beats
some sense into the canonical type computation (it's supposed to glob
everything that is supposed to TBAA-alias and that is allowed as
useless_type_conversion_p-compatible for aggregates).

LTO bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2014-01-09  Richard Biener  <rguenther@suse.de>

	PR lto/45586
	* lto.c (hash_canonical_type): Do not hash TREE_ADDRESSABLE,
	TYPE_ALIGN, TYPE_RESTRICT or TYPE_REF_CAN_ALIAS_ALL.
	(gimple_canonical_types_compatible_p): Do not compare them either.


Index: gcc/lto/lto.c
===================================================================
*** gcc/lto/lto.c	(revision 206459)
--- gcc/lto/lto.c	(working copy)
*************** hash_canonical_type (tree type)
*** 280,287 ****
       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 (TREE_ADDRESSABLE (type), v);
-   v = iterative_hash_hashval_t (TYPE_ALIGN (type), v);
    v = iterative_hash_hashval_t (TYPE_MODE (type), v);
  
    /* Incorporate common features of numerical types.  */
--- 280,285 ----
*************** hash_canonical_type (tree type)
*** 308,316 ****
       pointed to but do not recurse to the pointed-to type.  */
    if (POINTER_TYPE_P (type))
      {
-       v = iterative_hash_hashval_t (TYPE_REF_CAN_ALIAS_ALL (type), v);
        v = iterative_hash_hashval_t (TYPE_ADDR_SPACE (TREE_TYPE (type)), v);
-       v = iterative_hash_hashval_t (TYPE_RESTRICT (type), v);
        v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v);
      }
  
--- 306,312 ----
*************** gimple_canonical_types_compatible_p (tre
*** 447,455 ****
    if (TREE_CODE (t1) != TREE_CODE (t2))
      return false;
  
-   if (TREE_ADDRESSABLE (t1) != TREE_ADDRESSABLE (t2))
-     return false;
- 
    /* Qualifiers do not matter for canonical type comparison purposes.  */
  
    /* Void types and nullptr types are always the same.  */
--- 443,448 ----
*************** gimple_canonical_types_compatible_p (tre
*** 458,465 ****
      return true;
  
    /* Can't be the same type if they have different alignment, or mode.  */
!   if (TYPE_ALIGN (t1) != TYPE_ALIGN (t2)
!       || TYPE_MODE (t1) != TYPE_MODE (t2))
      return false;
  
    /* Non-aggregate types can be handled cheaply.  */
--- 451,457 ----
      return true;
  
    /* Can't be the same type if they have different alignment, or mode.  */
!   if (TYPE_MODE (t1) != TYPE_MODE (t2))
      return false;
  
    /* Non-aggregate types can be handled cheaply.  */
*************** gimple_canonical_types_compatible_p (tre
*** 486,503 ****
  	 useless_type_conversion_p would do.  */
        if (POINTER_TYPE_P (t1))
  	{
- 	  /* If the two pointers have different ref-all attributes,
- 	     they can't be the same type.  */
- 	  if (TYPE_REF_CAN_ALIAS_ALL (t1) != TYPE_REF_CAN_ALIAS_ALL (t2))
- 	    return false;
- 
  	  if (TYPE_ADDR_SPACE (TREE_TYPE (t1))
  	      != TYPE_ADDR_SPACE (TREE_TYPE (t2)))
  	    return false;
  
- 	  if (TYPE_RESTRICT (t1) != TYPE_RESTRICT (t2))
- 	    return false;
- 
  	  if (TREE_CODE (TREE_TYPE (t1)) != TREE_CODE (TREE_TYPE (t2)))
  	    return false;
  	}
--- 478,487 ----
Jakub Jelinek Jan. 9, 2014, 12:20 p.m. UTC | #2
On Thu, Jan 09, 2014 at 12:48:49PM +0100, Richard Biener wrote:
> *************** gimple_canonical_types_compatible_p (tre
> *** 458,465 ****
>       return true;
>   
>     /* Can't be the same type if they have different alignment, or mode.  */
> !   if (TYPE_ALIGN (t1) != TYPE_ALIGN (t2)
> !       || TYPE_MODE (t1) != TYPE_MODE (t2))
>       return false;
>   
>     /* Non-aggregate types can be handled cheaply.  */
> --- 451,457 ----
>       return true;
>   
>     /* Can't be the same type if they have different alignment, or mode.  */
> !   if (TYPE_MODE (t1) != TYPE_MODE (t2))

The comment needs updating then.

	Jakub
Richard Biener Jan. 9, 2014, 12:34 p.m. UTC | #3
On Thu, 9 Jan 2014, Jakub Jelinek wrote:

> On Thu, Jan 09, 2014 at 12:48:49PM +0100, Richard Biener wrote:
> > *************** gimple_canonical_types_compatible_p (tre
> > *** 458,465 ****
> >       return true;
> >   
> >     /* Can't be the same type if they have different alignment, or mode.  */
> > !   if (TYPE_ALIGN (t1) != TYPE_ALIGN (t2)
> > !       || TYPE_MODE (t1) != TYPE_MODE (t2))
> >       return false;
> >   
> >     /* Non-aggregate types can be handled cheaply.  */
> > --- 451,457 ----
> >       return true;
> >   
> >     /* Can't be the same type if they have different alignment, or mode.  */
> > !   if (TYPE_MODE (t1) != TYPE_MODE (t2))
> 
> The comment needs updating then.

Fixed.

Richard.
diff mbox

Patch

--- ../_clean/gcc/lto/lto.c	2014-01-04 15:51:44.000000000 +0100
+++ gcc/lto/lto.c	2014-01-08 08:26:09.000000000 +0100
@@ -310,7 +310,7 @@  hash_canonical_type (tree type)
     {
       v = iterative_hash_hashval_t (TYPE_REF_CAN_ALIAS_ALL (type), v);
       v = iterative_hash_hashval_t (TYPE_ADDR_SPACE (TREE_TYPE (type)), v);
-      v = iterative_hash_hashval_t (TYPE_RESTRICT (type), v);
+      /* v = iterative_hash_hashval_t (TYPE_RESTRICT (type), v); */
       v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v);
     }
 
@@ -495,8 +495,8 @@  gimple_canonical_types_compatible_p (tre
 	      != TYPE_ADDR_SPACE (TREE_TYPE (t2)))
 	    return false;
 
-	  if (TYPE_RESTRICT (t1) != TYPE_RESTRICT (t2))
-	    return false;
+	  /* if (TYPE_RESTRICT (t1) != TYPE_RESTRICT (t2))
+	    return false; */
 
 	  if (TREE_CODE (TREE_TYPE (t1)) != TREE_CODE (TREE_TYPE (t2)))
 	    return false;