diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-07-09 18:53:35 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-07-09 18:53:35 +0000 |
commit | 238065a73bd2bab6c3eb69e6d43cd8115a5b4245 (patch) | |
tree | d7f84fe48d87db0df890f2f77c86736581a54e5d /gcc/tree-switch-conversion.c | |
parent | 06e3e32bcd55600300f4a393a77bb582ff68cdf9 (diff) | |
download | gcc-238065a73bd2bab6c3eb69e6d43cd8115a5b4245.zip gcc-238065a73bd2bab6c3eb69e6d43cd8115a5b4245.tar.gz gcc-238065a73bd2bab6c3eb69e6d43cd8115a5b4245.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r-- | gcc/tree-switch-conversion.c | 10 |
1 files changed, 8 insertions, 2 deletions
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); |