public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][?/n] Cleanup LTO type merging
Date: Fri, 13 May 2011 15:00:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.00.1105131558200.810@zhemvz.fhfr.qr> (raw)


This gets rid of type pair caching in the canonical type comparison.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2011-05-13  Richard Guenther  <rguenther@suse.de>

	* gimple.c (gimple_canonical_types_compatible_p): Do not use
	type-pair caching, do not compare hashes.

Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c	(revision 173730)
+++ gcc/gimple.c	(working copy)
@@ -4569,8 +4569,6 @@ gimple_register_type (tree t)
 static bool
 gimple_canonical_types_compatible_p (tree t1, tree t2)
 {
-  type_pair_t p = NULL;
-
   /* Before starting to set up the SCC machinery handle simple cases.  */
 
   /* Check first for the obvious case of pointer identity.  */
@@ -4656,27 +4654,9 @@ gimple_canonical_types_compatible_p (tre
       return true;
     }
 
-  /* If the hash values of t1 and t2 are different the types can't
-     possibly be the same.  This helps keeping the type-pair hashtable
-     small, only tracking comparisons for hash collisions.  */
-  if (gimple_canonical_type_hash (t1) != gimple_canonical_type_hash (t2))
-    return false;
-
-  /* If we've visited this type pair before (in the case of aggregates
-     with self-referential types), and we made a decision, return it.  */
-  p = lookup_type_pair (t1, t2, &gtc_visited, &gtc_ob);
-  if (p->same_p[GTC_DIAG] == 0 || p->same_p[GTC_DIAG] == 1)
-    {
-      /* We have already decided whether T1 and T2 are the
-	 same, return the cached result.  */
-      return p->same_p[GTC_DIAG] == 1;
-    }
-
-  gcc_assert (p->same_p[GTC_DIAG] == -2);
-
   /* 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;
+    return false;
 
   /* Do type-specific comparisons.  */
   switch (TREE_CODE (t1))
@@ -4687,7 +4667,7 @@ gimple_canonical_types_compatible_p (tre
       if (!gimple_canonical_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2))
 	  || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)
 	  || TYPE_NONALIASED_COMPONENT (t1) != TYPE_NONALIASED_COMPONENT (t2))
-	goto different_types;
+	return false;
       else
 	{
 	  tree i1 = TYPE_DOMAIN (t1);
@@ -4696,16 +4676,16 @@ gimple_canonical_types_compatible_p (tre
 	  /* For an incomplete external array, the type domain can be
  	     NULL_TREE.  Check this condition also.  */
 	  if (i1 == NULL_TREE && i2 == NULL_TREE)
-	    goto same_types;
+	    return true;
 	  else if (i1 == NULL_TREE || i2 == NULL_TREE)
-	    goto different_types;
+	    return false;
 	  /* If for a complete array type the possibly gimplified sizes
 	     are different the types are different.  */
 	  else if (((TYPE_SIZE (i1) != NULL) ^ (TYPE_SIZE (i2) != NULL))
 		   || (TYPE_SIZE (i1)
 		       && TYPE_SIZE (i2)
 		       && !operand_equal_p (TYPE_SIZE (i1), TYPE_SIZE (i2), 0)))
-	    goto different_types;
+	    return false;
 	  else
 	    {
 	      tree min1 = TYPE_MIN_VALUE (i1);
@@ -4724,9 +4704,9 @@ gimple_canonical_types_compatible_p (tre
 			  && ((TREE_CODE (max1) == PLACEHOLDER_EXPR
 			       && TREE_CODE (max2) == PLACEHOLDER_EXPR)
 			      || operand_equal_p (max1, max2, 0)))))
-		goto same_types;
+		return true;
 	      else
-		goto different_types;
+		return false;
 	    }
 	}
 
@@ -4734,7 +4714,7 @@ gimple_canonical_types_compatible_p (tre
       /* Method types should belong to the same class.  */
       if (!gimple_canonical_types_compatible_p
 	     (TYPE_METHOD_BASETYPE (t1), TYPE_METHOD_BASETYPE (t2)))
-	goto different_types;
+	return false;
 
       /* Fallthru  */
 
@@ -4745,13 +4725,13 @@ gimple_canonical_types_compatible_p (tre
 	     (TREE_TYPE (t1), TREE_TYPE (t2))
 	  && !gimple_canonical_types_compatible_p
 	        (TREE_TYPE (t1), TREE_TYPE (t2)))
-	goto different_types;
+	return false;
 
       if (!comp_type_attributes (t1, t2))
-	goto different_types;
+	return false;
 
       if (TYPE_ARG_TYPES (t1) == TYPE_ARG_TYPES (t2))
-	goto same_types;
+	return true;
       else
 	{
 	  tree parms1, parms2;
@@ -4764,13 +4744,13 @@ gimple_canonical_types_compatible_p (tre
 		         (TREE_VALUE (parms1), TREE_VALUE (parms2))
 		  && !gimple_canonical_types_compatible_p
 		        (TREE_VALUE (parms1), TREE_VALUE (parms2)))
-		goto different_types;
+		return false;
 	    }
 
 	  if (parms1 || parms2)
-	    goto different_types;
+	    return false;
 
-	  goto same_types;
+	  return true;
 	}
 
     case RECORD_TYPE:
@@ -4789,30 +4769,20 @@ gimple_canonical_types_compatible_p (tre
 		|| !gimple_compare_field_offset (f1, f2)
 		|| !gimple_canonical_types_compatible_p
 		      (TREE_TYPE (f1), TREE_TYPE (f2)))
-	      goto different_types;
+	      return false;
 	  }
 
 	/* If one aggregate has more fields than the other, they
 	   are not the same.  */
 	if (f1 || f2)
-	  goto different_types;
+	  return false;
 
-	goto same_types;
+	return true;
       }
 
     default:
       gcc_unreachable ();
     }
-
-  /* Common exit path for types that are not compatible.  */
-different_types:
-  p->same_p[GTC_DIAG] = 0;
-  return false;
-
-  /* Common exit path for types that are compatible.  */
-same_types:
-  p->same_p[GTC_DIAG] = 1;
-  return true;
 }
 
 

             reply	other threads:[~2011-05-13 13:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 15:00 Richard Guenther [this message]
2011-05-16 15:36 Richard Guenther
2011-05-16 15:46 Richard Guenther
2011-05-17  3:13 ` H.J. Lu
2011-05-17 13:03   ` Richard Guenther
2011-05-17 15:32     ` H.J. Lu
2011-05-17 15:33       ` H.J. Lu
2011-05-17 15:52         ` Richard Guenther
2011-05-17 16:04           ` H.J. Lu
2011-05-16 17:09 Richard Guenther
2011-05-16 20:51 ` Jan Hubicka
2011-05-16 22:39   ` H.J. Lu
2011-05-17 11:41   ` Richard Guenther
2011-05-17 13:54     ` Jan Hubicka
2011-05-19 14:39 Richard Guenther

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1105131558200.810@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).