From: Steven Bosscher Date: Wed, 7 Jul 2004 22:19:43 +0000 (+0000) Subject: tree-cfg (group_case_labels): Remove case labels that have the same target as the... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=31e9eea2e8f655ca4bc1e3f059b647e23d3989d2;p=gcc.git tree-cfg (group_case_labels): Remove case labels that have the same target as the default case. * tree-cfg (group_case_labels): Remove case labels that have the same target as the default case. From-SVN: r84239 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a1aa65406d3..6031eee9398 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-07-07 Steven Bosscher + + * tree-cfg.c (group_case_labels): Remove case labels that have + the same target as the default case. + 2004-07-07 Steven Bosscher * tree-inline.c (optimize_inline_calls): Set DECL_INLINED_FNS diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 4bf00dff375..8600a99e412 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -937,6 +937,7 @@ group_case_labels (void) tree labels = SWITCH_LABELS (stmt); int old_size = TREE_VEC_LENGTH (labels); int i, j, new_size = old_size; + tree default_label = TREE_VEC_ELT (labels, old_size - 1); /* Look for possible opportunities to merge cases. Ignore the last element of the label vector because it @@ -950,8 +951,18 @@ group_case_labels (void) if (! base_case) abort (); - type = TREE_TYPE (CASE_LOW (base_case)); base_label = CASE_LABEL (base_case); + + /* Discard cases that have the same destination as the + default case. */ + if (base_label == default_label) + { + TREE_VEC_ELT (labels, i) = NULL_TREE; + i++; + continue; + } + + type = TREE_TYPE (CASE_LOW (base_case)); base_high = CASE_HIGH (base_case) ? CASE_HIGH (base_case) : CASE_LOW (base_case);