From 5372d0883b5a9f07843d082ed56e60b3351757a1 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 26 Oct 2004 15:35:20 +0000 Subject: [PATCH] stmt.c (expand_case): Remove code to handle SWITCH_EXPR with a default case only. * stmt.c (expand_case): Remove code to handle SWITCH_EXPR with a default case only. From-SVN: r89585 --- gcc/ChangeLog | 5 +++++ gcc/stmt.c | 29 +++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bc2a4ecc2be..916baf24d4b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-10-26 Kazu Hirata + + * stmt.c (expand_case): Remove code to handle SWITCH_EXPR with + a default case only. + 2004-10-26 Aldy Hernandez * config/rs6000/rs6000.c (rs6000_hard_regno_nregs): Adjust for diff --git a/gcc/stmt.c b/gcc/stmt.c index 9570f2504e4..bb17fa2e4e6 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -2419,27 +2419,24 @@ expand_case (tree exp) } } - /* Compute span of values. */ - if (count != 0) - range = fold (build2 (MINUS_EXPR, index_type, maxval, minval)); + /* cleanup_tree_cfg removes all SWITCH_EXPR with a single + destination, such as one with a default case only. */ + gcc_assert (count != 0); - if (count == 0) - { - expand_expr (index_expr, const0_rtx, VOIDmode, 0); - emit_jump (default_label); - } + /* Compute span of values. */ + range = fold (build2 (MINUS_EXPR, index_type, maxval, minval)); /* Try implementing this switch statement by a short sequence of bit-wise comparisons. However, we let the binary-tree case below handle constant index expressions. */ - else if (CASE_USE_BIT_TESTS - && ! TREE_CONSTANT (index_expr) - && compare_tree_int (range, GET_MODE_BITSIZE (word_mode)) < 0 - && compare_tree_int (range, 0) > 0 - && lshift_cheap_p () - && ((uniq == 1 && count >= 3) - || (uniq == 2 && count >= 5) - || (uniq == 3 && count >= 6))) + if (CASE_USE_BIT_TESTS + && ! TREE_CONSTANT (index_expr) + && compare_tree_int (range, GET_MODE_BITSIZE (word_mode)) < 0 + && compare_tree_int (range, 0) > 0 + && lshift_cheap_p () + && ((uniq == 1 && count >= 3) + || (uniq == 2 && count >= 5) + || (uniq == 3 && count >= 6))) { /* Optimize the case where all the case values fit in a word without having to subtract MINVAL. In this case, -- 2.30.2