PR tree-opt/17343
* gcc.dg/tree-ssa/pr17343.c: New test.
2004-10-01 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/17343
* tree-cfg.c (group_case_labels): Get the label and not
the case expr for the default case.
When the label we looking at is the default, decrement the
new_size.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88397
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-10-01 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR tree-opt/17343
+ * tree-cfg.c (group_case_labels): Get the label and not
+ the case expr for the default case.
+ When the label we looking at is the default, decrement the
+ new_size.
+
2004-10-01 Jan Hubicka <jh@suse.cz>
* c-decl.c (c_expand_body): Update call tree_rest_of_compilation.
+2004-10-01 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR tree-opt/17343
+ * gcc.dg/tree-ssa/pr17343.c: New test.
+
2004-10-01 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/tree-ssa/stdarg-1.c: Removed.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized" } */
+void foo0(void);
+void foo1(void);
+void foo2(void);
+void foo3(void);
+
+void
+foo (int a)
+{
+ switch (a)
+ {
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ goto ddd;
+ case 14:
+ foo1();
+ break;
+ case 15:
+ foo2();
+ break;
+ case 16:
+ foo3();
+ break;
+ default:
+ ddd:
+ foo0();
+ break;
+ }
+}
+/* There should be precisely two references to ddd. One in the switch
+ and one for the label, we used not to combine the case 10-13 into
+ the default case. */
+/* { dg-final { scan-tree-dump-times "ddd" 1 "optimized"} } */
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);
+ tree default_case = TREE_VEC_ELT (labels, old_size - 1);
+ tree default_label;
+
+ /* The default lable is always the last case in a switch
+ statement after gimplification. */
+ default_label = CASE_LABEL (default_case);
/* Look for possible opportunities to merge cases.
Ignore the last element of the label vector because it
{
TREE_VEC_ELT (labels, i) = NULL_TREE;
i++;
+ new_size--;
continue;
}