]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
flow.c (delete_dead_jumptables): Speed up by scanning insns that do not belong to...
authorKazu Hirata <kazu@cs.umass.edu>
Mon, 21 Feb 2005 19:47:40 +0000 (19:47 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 21 Feb 2005 19:47:40 +0000 (19:47 +0000)
* flow.c (delete_dead_jumptables): Speed up by scanning insns
that do not belong to any basic block.

From-SVN: r95342

gcc/ChangeLog
gcc/flow.c

index e18b08a627117ab98e5d86767e1f638c9878c1a1..fea868a638e6c98073b3e7880a68d3caa98e8f5c 100644 (file)
@@ -7,6 +7,9 @@
        and 1.
        (find_taken_edge_switch_expr): Remove a check for INTEGER_CST.
 
+       * flow.c (delete_dead_jumptables): Speed up by scanning insns
+       that do not belong to any basic block.
+
 2005-02-21  Jeff Law  <law@redhat.com>
 
        * cfganal.c (find_unreachable_blocks): Manually CSE load of
index 172541d2fa58ba513850065ba41fcfc9719d1a06..d3850cc9618f5f3954d45bdc472bf60ab670f4e0 100644 (file)
@@ -817,21 +817,35 @@ delete_noop_moves (void)
 void
 delete_dead_jumptables (void)
 {
-  rtx insn, next;
-  for (insn = get_insns (); insn; insn = next)
+  basic_block bb;
+
+  /* A dead jump table does not belong to any basic block.  Scan insns
+     between two adjacent basic blocks.  */
+  FOR_EACH_BB (bb)
     {
-      next = NEXT_INSN (insn);
-      if (LABEL_P (insn)
-         && LABEL_NUSES (insn) == LABEL_PRESERVE_P (insn)
-         && JUMP_P (next)
-         && (GET_CODE (PATTERN (next)) == ADDR_VEC
-             || GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC))
+      rtx insn, next;
+
+      for (insn = NEXT_INSN (BB_END (bb));
+          insn && !NOTE_INSN_BASIC_BLOCK_P (insn);
+          insn = next)
        {
-         if (dump_file)
-           fprintf (dump_file, "Dead jumptable %i removed\n", INSN_UID (insn));
-         delete_insn (NEXT_INSN (insn));
-         delete_insn (insn);
-         next = NEXT_INSN (next);
+         next = NEXT_INSN (insn);
+         if (LABEL_P (insn)
+             && LABEL_NUSES (insn) == LABEL_PRESERVE_P (insn)
+             && JUMP_P (next)
+             && (GET_CODE (PATTERN (next)) == ADDR_VEC
+                 || GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC))
+           {
+             rtx label = insn, jump = next;
+
+             if (dump_file)
+               fprintf (dump_file, "Dead jumptable %i removed\n",
+                        INSN_UID (insn));
+
+             next = NEXT_INSN (next);
+             delete_insn (jump);
+             delete_insn (label);
+           }
        }
     }
 }