diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-07 22:19:43 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-07 22:19:43 +0000 |
commit | 6722b48564f50e11874dbc1d61020283bafada7f (patch) | |
tree | cebb5009c240f7327074a7762f98f51e661237a0 | |
parent | 932fd77bd9ebc42eb7fcec096516dcec19520ae0 (diff) | |
download | gcc-6722b48564f50e11874dbc1d61020283bafada7f.tar.gz |
* tree-cfg (group_case_labels): Remove case labels that have the
same target as the default case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84239 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a1aa65406d3..6031eee9398 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2004-07-07 Steven Bosscher <stevenb@suse.de> + * tree-cfg.c (group_case_labels): Remove case labels that have + the same target as the default case. + +2004-07-07 Steven Bosscher <stevenb@suse.de> + * tree-inline.c (optimize_inline_calls): Set DECL_INLINED_FNS regardless of DECL_LANG_SPECIFIC being present or not. * tree.h (DECL_NUM_STMTS): Purge. 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); |