aboutsummaryrefslogtreecommitdiff
path: root/gcc/flow.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2005-02-21 19:47:40 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2005-02-21 19:47:40 +0000
commit88312d26a5b32bf7ae7d593d8c12517623106c6f (patch)
tree5527b039f988d6e0b9585b5f8a80477d6ee437bc /gcc/flow.c
parentfca01525bf39af39d545094e75cb72276f46013c (diff)
downloadgcc-88312d26a5b32bf7ae7d593d8c12517623106c6f.zip
gcc-88312d26a5b32bf7ae7d593d8c12517623106c6f.tar.gz
gcc-88312d26a5b32bf7ae7d593d8c12517623106c6f.tar.bz2
flow.c (delete_dead_jumptables): Speed up by scanning insns that do not belong to any basic block.
* flow.c (delete_dead_jumptables): Speed up by scanning insns that do not belong to any basic block. From-SVN: r95342
Diffstat (limited to 'gcc/flow.c')
-rw-r--r--gcc/flow.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/gcc/flow.c b/gcc/flow.c
index 172541d..d3850cc 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -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);
+ }
}
}
}