aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-switch-conversion.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-10-22 15:09:33 +0200
committerMartin Liska <marxin@gcc.gnu.org>2018-10-22 13:09:33 +0000
commitd78bcb133d4559273bf6f6125f2659354e3f505e (patch)
tree4e08ef3d6089ef46215679fc69d772ff9e2bf845 /gcc/tree-switch-conversion.c
parentc7acc2964eb184e9151a822cd74b96890804a81e (diff)
Revert r263947.
2018-10-22 Martin Liska <mliska@suse.cz> PR tree-optimization/87686 Revert 2018-08-29 Martin Liska <mliska@suse.cz> * tree-switch-conversion.c (switch_conversion::expand): Strenghten assumption about gswitch statements. 2018-10-22 Martin Liska <mliska@suse.cz> PR tree-optimization/87686 * g++.dg/tree-ssa/pr87686.C: New test. From-SVN: r265388
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r--gcc/tree-switch-conversion.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 64169a6cd3d..ac2aa585257 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -913,7 +913,14 @@ switch_conversion::expand (gswitch *swtch)
/* Group case labels so that we get the right results from the heuristics
that decide on the code generation approach for this switch. */
m_cfg_altered |= group_case_labels_stmt (swtch);
- gcc_assert (gimple_switch_num_labels (swtch) >= 2);
+
+ /* 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)
+ {
+ m_reason = "switch is a degenerate case";
+ return;
+ }
collect (swtch);