patches/gcc/4.4.4/190-flatten-switch-stmt-00.patch
changeset 1953 a93af06e180d
child 2148 ada9128c98b8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.4.4/190-flatten-switch-stmt-00.patch	Sun May 16 19:41:53 2010 +0200
     1.3 @@ -0,0 +1,26 @@
     1.4 +diff -durN gcc-4.4.0.orig/gcc/stmt.c gcc-4.4.0/gcc/stmt.c
     1.5 +
     1.6 +diff -durN gcc-4.4.4.orig/gcc/stmt.c gcc-4.4.4/gcc/stmt.c
     1.7 +--- gcc-4.4.4.orig/gcc/stmt.c	2010-03-08 12:46:28.000000000 +0100
     1.8 ++++ gcc-4.4.4/gcc/stmt.c	2010-05-16 19:12:31.000000000 +0200
     1.9 +@@ -2377,7 +2377,11 @@
    1.10 + 	  use_cost_table
    1.11 + 	    = (TREE_CODE (orig_type) != ENUMERAL_TYPE
    1.12 + 	       && estimate_case_costs (case_list));
    1.13 +-	  balance_case_nodes (&case_list, NULL);
    1.14 ++	  /* When optimizing for size, we want a straight list to avoid
    1.15 ++	     jumps as much as possible. This basically creates an if-else
    1.16 ++	     chain.  */
    1.17 ++	  if (!optimize_size)
    1.18 ++	    balance_case_nodes (&case_list, NULL);
    1.19 + 	  emit_case_nodes (index, case_list, default_label, index_type);
    1.20 + 	  if (default_label)
    1.21 + 	    emit_jump (default_label);
    1.22 +@@ -2943,6 +2947,7 @@
    1.23 + 	    {
    1.24 + 	      if (!node_has_low_bound (node, index_type))
    1.25 + 		{
    1.26 ++		  if (!optimize_size) /* don't jl to the .default_label. */
    1.27 + 		  emit_cmp_and_jump_insns (index,
    1.28 + 					   convert_modes
    1.29 + 					   (mode, imode,