diff options
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r-- | gcc/cfgrtl.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index fdaefa213f8..f20fa7a69a9 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -1796,6 +1796,24 @@ rtl_tidy_fallthru_edge (edge e) && (any_uncondjump_p (q) || single_succ_p (b))) { + rtx label; + rtx_jump_table_data *table; + + if (tablejump_p (q, &label, &table)) + { + /* The label is likely mentioned in some instruction before + the tablejump and might not be DCEd, so turn it into + a note instead and move before the tablejump that is going to + be deleted. */ + const char *name = LABEL_NAME (label); + PUT_CODE (label, NOTE); + NOTE_KIND (label) = NOTE_INSN_DELETED_LABEL; + NOTE_DELETED_LABEL_NAME (label) = name; + rtx_insn *lab = safe_as_a <rtx_insn *> (label); + reorder_insns (lab, lab, PREV_INSN (q)); + delete_insn (table); + } + #ifdef HAVE_cc0 /* If this was a conditional jump, we need to also delete the insn that set cc0. */ |