Patchwork Make LTO type merging cheaper

login
register
mail settings
Submitter Richard Guenther
Date July 13, 2012, 8:11 a.m.
Message ID <alpine.LNX.2.00.1207131010090.17088@jbgna.fhfr.qr>
Download mbox | patch
Permalink /patch/170814/
State New
Headers show

Comments

Richard Guenther - July 13, 2012, 8:11 a.m.
A patch that's in my local tree for quite some time.  This removes
redundant tests.

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

Richard.

2012-07-13  Richard Guenther  <rguenther@suse.de>

	* gimple.c (gimple_types_compatible_p_1): Remove redundant
	type attribute comparisons.
	(gimple_canonical_types_compatible_p): Likewise.
H.J. Lu - July 14, 2012, 2:16 a.m.
On Fri, Jul 13, 2012 at 1:11 AM, Richard Guenther <rguenther@suse.de> wrote:
>
> A patch that's in my local tree for quite some time.  This removes
> redundant tests.
>
> LTO bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
>
> Richard.
>
> 2012-07-13  Richard Guenther  <rguenther@suse.de>
>
>         * gimple.c (gimple_types_compatible_p_1): Remove redundant
>         type attribute comparisons.
>         (gimple_canonical_types_compatible_p): Likewise.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53959
H.J. Lu - July 14, 2012, 2:51 p.m.
On Fri, Jul 13, 2012 at 1:11 AM, Richard Guenther <rguenther@suse.de> wrote:
>
> A patch that's in my local tree for quite some time.  This removes
> redundant tests.
>
> LTO bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
>
> Richard.
>
> 2012-07-13  Richard Guenther  <rguenther@suse.de>
>
>         * gimple.c (gimple_types_compatible_p_1): Remove redundant
>         type attribute comparisons.
>         (gimple_canonical_types_compatible_p): Likewise.
>
> Index: gcc/gimple.c
> ===================================================================
> --- gcc/gimple.c        (revision 189311)
> +++ gcc/gimple.c        (working copy)
> @@ -3422,10 +3422,6 @@ gimple_types_compatible_p_1 (tree t1, tr
>         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;
> -
>    /* Do type-specific comparisons.  */
>    switch (TREE_CODE (t1))
>      {

I don't see why this is redundant since attributes aren't checked anywhere
else.  Revert this part fixes:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53959

Patch

Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c	(revision 189311)
+++ gcc/gimple.c	(working copy)
@@ -3422,10 +3422,6 @@  gimple_types_compatible_p_1 (tree t1, tr
 	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;
-
   /* Do type-specific comparisons.  */
   switch (TREE_CODE (t1))
     {
@@ -4449,10 +4445,6 @@  gimple_canonical_types_compatible_p (tre
       return true;
     }
 
-  /* If their attributes are not the same they can't be the same type.  */
-  if (!attribute_list_equal (TYPE_ATTRIBUTES (t1), TYPE_ATTRIBUTES (t2)))
-    return false;
-
   /* Do type-specific comparisons.  */
   switch (TREE_CODE (t1))
     {
@@ -4499,13 +4491,6 @@  gimple_canonical_types_compatible_p (tre
 	}
 
     case METHOD_TYPE:
-      /* Method types should belong to the same class.  */
-      if (!gimple_canonical_types_compatible_p
-	     (TYPE_METHOD_BASETYPE (t1), TYPE_METHOD_BASETYPE (t2)))
-	return false;
-
-      /* Fallthru  */
-
     case FUNCTION_TYPE:
       /* Function types are the same if the return type and arguments types
 	 are the same.  */