From 238065a73bd2bab6c3eb69e6d43cd8115a5b4245 Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Mon, 9 Jul 2012 18:53:35 +0000 Subject: re PR middle-end/53887 (ICE in hoist_edge_and_branch_if_true, at tree-switch-conversion.c:79) gcc/ PR tree-optimization/53887 * tree-cfg.c (group_case_labels_stmt): Make non-static. * tree-flow.h (group_case_labels_stmt): Add prototype. * tree-switch-conversion.c (process_switch): Use group_case_labels_stmt to pre-process every switch. testsuite/ PR tree-optimization/53887 * gcc.dg/pr53887.c: New test. From-SVN: r189389 --- gcc/tree-switch-conversion.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc/tree-switch-conversion.c') diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index 94fbf1d..8045798 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -1339,8 +1339,14 @@ process_switch (gimple swtch) { struct switch_conv_info info; - /* Degenerate case with only a default label should never happen. */ - gcc_checking_assert (gimple_switch_num_labels (swtch) > 1); + /* Group case labels so that we get the right results from the heuristics + that decide on the code generation approach for this switch. */ + group_case_labels_stmt (swtch); + + /* If this switch is now a degenerate case with only a default label, + there is nothing left for us to do. */ + if (gimple_switch_num_labels (swtch) < 2) + return "switch is a degenerate case"; collect_switch_conv_info (swtch, &info); -- cgit v1.1