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] cse.c: Speed up delete_trivially_dead_insns - Part 2


Hi,

Attached is a patch to speed up delete_trivially_dead_insns.

When delete_trivially_dead_insns scans the insn chain *backward*, it
keeps track of whether the current insn being scanned is a part of a
libcall or not.  Specifically, it calls for each insn

  find_reg_note (insn, REG_RETVAL, NULL_RTX)

and

  find_reg_note (insn, REG_LIBCALL, NULL_RTX)

to maintain local variable IN_LIBCALL.  Of these two calls, the latter
obviously isn't needed if we are not in a libcall.

The patch simply avoids the latter if we are not in a libcall.

Here is a timing in seconds for five runs of ./cc1 -quiet -O2
-fomit-frame-pointer -o /dev/null.

               original patched   diff%
c-common.i       17.940  17.894 -0.256%
combine.i        16.435  16.394 -0.249%
fold-const.i     36.947  36.775 -0.465%
reload1.i        12.879  12.864 -0.116%
reload.i         11.878  11.863 -0.126%
insn-attrtab.i  173.949 173.554 -0.227%

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

Kazu Hirata

2005-02-24  Kazu Hirata  <kazu@cs.umass.edu>

	* cse.c (delete_trivially_dead_insns): Speed up by minimizing
	calls to find_reg_note.

Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.344
diff -u -d -p -r1.344 cse.c
--- cse.c	24 Feb 2005 01:55:11 -0000	1.344
+++ cse.c	24 Feb 2005 16:17:07 -0000
@@ -7329,7 +7329,7 @@ delete_trivially_dead_insns (rtx insns, 
 	  ndead++;
 	}
 
-      if (find_reg_note (insn, REG_LIBCALL, NULL_RTX))
+      if (in_libcall && find_reg_note (insn, REG_LIBCALL, NULL_RTX))
 	{
 	  in_libcall = 0;
 	  dead_libcall = 0;


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