re PR middle-end/11823 (Optimizing large jump tables for switch statements)
authorSteven Bosscher <steven@gcc.gnu.org>
Sun, 31 Aug 2003 13:59:33 +0000 (13:59 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sun, 31 Aug 2003 13:59:33 +0000 (13:59 +0000)
PR middle-end/11823
* stmt.c (expand_end_case_type): Only use jump tables for dense
switch statements when optimizing for size.

Co-Authored-By: Roger Sayle <roger@eyesopen.com>
From-SVN: r70959

gcc/ChangeLog
gcc/stmt.c

index 790f581ea98152b3f43a31e1ba8e08db35e79f36..422ceb9fd2c43a70618076faff9575e57e2f6b06 100644 (file)
@@ -1,3 +1,10 @@
+2003-08-31  Steven Bosscher  <steven@gcc.gnu.org>
+           Roger Sayle  <roger@eyesopen.com>
+
+       PR middle-end/11823
+       * stmt.c (expand_end_case_type): Only use jump tables for dense
+       switch statements when optimizing for size.
+
 2003-08-31  Olivier Hainque  <hainque@act-europe.fr>
 
         * builtins.c (expand_builtin_setjmp): Use emit_jump to jump around
index 54c93be7909a0803eb98b3e8806297d78706545e..9a8c0bc6cb95a86b88ce3be599c4172af958d960 100644 (file)
@@ -5419,7 +5419,8 @@ expand_end_case_type (tree orig_index, tree orig_type)
         because we can optimize it.  */
 
       else if (count < case_values_threshold ()
-              || compare_tree_int (range, 10 * count) > 0
+              || compare_tree_int (range,
+                                   (optimize_size ? 3 : 10) * count) > 0
               /* RANGE may be signed, and really large ranges will show up
                  as negative numbers.  */
               || compare_tree_int (range, 0) < 0