cse.c (delete_trivially_dead_insns): Speed up by using NEXT_INSN and PREV_INSN direct...
authorKazu Hirata <kazu@cs.umass.edu>
Thu, 24 Feb 2005 01:55:11 +0000 (01:55 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Thu, 24 Feb 2005 01:55:11 +0000 (01:55 +0000)
* cse.c (delete_trivially_dead_insns): Speed up by using
NEXT_INSN and PREV_INSN directly instead of next_real_insn and
prev_real_insn.

From-SVN: r95488

gcc/ChangeLog
gcc/cse.c

index d232111..99c91c2 100644 (file)
@@ -1,3 +1,9 @@
+2005-02-24  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * cse.c (delete_trivially_dead_insns): Speed up by using
+       NEXT_INSN and PREV_INSN directly instead of next_real_insn and
+       prev_real_insn.
+
 2005-02-24  Andrea Tarani  <andrea.tarani@gilbarco.com>
 
        * config/m68k/m68k.c (m68k_save_reg): Also save A5 for non-leaf
index e16113c..5bc6ce4 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7284,8 +7284,9 @@ delete_trivially_dead_insns (rtx insns, int nreg)
   timevar_push (TV_DELETE_TRIVIALLY_DEAD);
   /* First count the number of times each register is used.  */
   counts = xcalloc (nreg, sizeof (int));
-  for (insn = next_real_insn (insns); insn; insn = next_real_insn (insn))
-    count_reg_usage (insn, counts, 1);
+  for (insn = insns; insn; insn = NEXT_INSN (insn))
+    if (INSN_P (insn))
+      count_reg_usage (insn, counts, 1);
 
   /* Go from the last insn to the first and delete insns that only set unused
      registers or copy a register to itself.  As we delete an insn, remove
@@ -7294,15 +7295,13 @@ delete_trivially_dead_insns (rtx insns, int nreg)
      The first jump optimization pass may leave a real insn as the last
      insn in the function.   We must not skip that insn or we may end
      up deleting code that is not really dead.  */
-  insn = get_last_insn ();
-  if (! INSN_P (insn))
-    insn = prev_real_insn (insn);
-
-  for (; insn; insn = prev)
+  for (insn = get_last_insn (); insn; insn = prev)
     {
       int live_insn = 0;
 
-      prev = prev_real_insn (insn);
+      prev = PREV_INSN (insn);
+      if (!INSN_P (insn))
+       continue;
 
       /* Don't delete any insns that are part of a libcall block unless
         we can delete the whole libcall block.