This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] rtlanal.c (reg_mentioned_p): Very tiny speedup.


Hi,

Attached is a patch to speed up reg_mentioned_p().

CONST_INT's are always shared, so

  INTVAL (op1) == INTVAL (op2) iff op1 == op2

Since the function returns 1 very early if reg == in, after that we
know that INTVAL (in) != INTVAL (reg).

Tested on i686-pc-linux-gnu.  OK to apply?

p.s.
Just to be on the safe side, I tested code like so, but this again
caused no regressions.

  case CONST_INT:
    if (GET_CODE (reg) == CONST_INT && INTVAL (in) == INTVAL (reg))
      abort ();
    return 0;

Kazu Hirata

2003-06-27  Kazu Hirata  <kazu@cs.umass.edu>

	* rtlanal.c (reg_mentioned_p): Return 0 earlier if REG and IN
	are known to be not equivalent.

Index: rtlanal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtlanal.c,v
retrieving revision 1.159
diff -u -4 -r1.159 rtlanal.c
--- rtlanal.c	23 Jun 2003 16:11:56 -0000	1.159
+++ rtlanal.c	27 Jun 2003 05:58:49 -0000
@@ -753,10 +753,8 @@
     case PC:
       return 0;
 
     case CONST_INT:
-      return GET_CODE (reg) == CONST_INT && INTVAL (in) == INTVAL (reg);
-
     case CONST_VECTOR:
     case CONST_DOUBLE:
       /* These are kept unique for a given value.  */
       return 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]