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] stmt.c (do_jump_if_equal): Very tiny speedup.


Hi,

Attached is a patch to speed up do_jump_if_equal().

CONST_INT's are always shared, so

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

The patch saves two pointer dereferences. :-)

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

p.s.
Just to be on the safe side, I inserted the following piece of code in
the same place, but this again caused no new regression.

  if (INTVAL (op1) == INTVAL (op2) && op1 != op2)
    abort ();

Kazu Hirata

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

	* jump.c (rtx_renumbered_equal_p): Return 0 earlier if X and Y
	are known to be not equivalent.

Index: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.309
diff -u -r1.309 stmt.c
--- stmt.c	25 Jun 2003 17:29:13 -0000	1.309
+++ stmt.c	26 Jun 2003 20:13:49 -0000
@@ -5756,7 +5756,7 @@
 {
   if (GET_CODE (op1) == CONST_INT && GET_CODE (op2) == CONST_INT)
     {
-      if (INTVAL (op1) == INTVAL (op2))
+      if (op1 == op2)
 	emit_jump (label);
     }
   else


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