cselib hash improvement

Bernd Schmidt bernds@redhat.com
Wed Mar 28 05:44:00 GMT 2001


Colin Howell remarked that my recent cselib fix could make the hash values
very non-random.  If we find a MEM or a REG, we have to return the number
of the corresponding value, but due to the tail recursion elimination, we
can forget about other parts of an rtx.

This patch should fix it by getting rid of the manual tail recursion
elimination, which probably gains less speed than stupid hash values
waste.

Bootstrapped on ia64-linux (up to an unrelated crash while compiling
libstdc++).  I'll check this in on the mainline and later on the 3.0
branch if it bootstraps on x86-linux as well.


Bernd

	* cselib.c (hash_rtx): Don't do tail recursion elimination by hand.

Index: gcc/cselib.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cselib.c,v
retrieving revision 1.4
diff -u -p -r1.4 cselib.c
--- gcc/cselib.c	2001/03/15 12:59:26	1.4
+++ gcc/cselib.c	2001/03/28 08:34:02
@@ -566,8 +566,6 @@ hash_rtx (x, mode, create)
   const char *fmt;
   unsigned int hash = 0;

-  /* repeat is used to turn tail-recursion into iteration.  */
- repeat:
   code = GET_CODE (x);
   hash += (unsigned) code + (unsigned) GET_MODE (x);

@@ -637,18 +635,8 @@ hash_rtx (x, mode, create)
       if (fmt[i] == 'e')
 	{
 	  rtx tem = XEXP (x, i);
-	  unsigned int tem_hash;
+	  unsigned int tem_hash = hash_rtx (tem, 0, create);

-	  /* If we are about to do the last recursive call
-	     needed at this level, change it into iteration.
-	     This function  is called enough to be worth it.  */
-	  if (i == 0)
-	    {
-	      x = tem;
-	      goto repeat;
-	    }
-
-	  tem_hash = hash_rtx (tem, 0, create);
 	  if (tem_hash == 0)
 	    return 0;




More information about the Gcc-patches mailing list