summaryrefslogtreecommitdiff
path: root/gcc/flow.c
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-21 19:47:40 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-21 19:47:40 +0000
commit251102fec8348b733b9f8e0b2b3e54f9b8a19f7c (patch)
tree5527b039f988d6e0b9585b5f8a80477d6ee437bc /gcc/flow.c
parent9677695f0f925e9a1a63365d125cc81c4eadbf06 (diff)
downloadgcc-251102fec8348b733b9f8e0b2b3e54f9b8a19f7c.tar.gz
* flow.c (delete_dead_jumptables): Speed up by scanning insns
that do not belong to any basic block. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95342 138bc75d-0d04-0410-961f-82ee72b054a4
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 172541d2fa5..d3850cc9618 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);
+ }
}
}
}