PR tree-optimization/34708 (too much inlining)

Jan Hubicka jh@suse.cz
Wed Jan 9 20:35:00 GMT 2008


Hi,
this is version of patch I comitted.

Index: ChangeLog
===================================================================
*** ChangeLog	(revision 131432)
--- ChangeLog	(working copy)
***************
*** 1,3 ****
--- 1,11 ----
+ 2008-01-09  Jan Hubicka  <jh@suse.cz>
+ 
+ 	PR tree-optimization/34708
+ 	* tree-inline.c (estimate_num_insns_1): Compute cost of SWITCH_EXPR
+ 	based on number of case labels.
+ 	(init_inline_once): Remove switch_cost.
+ 	* tree-inline.h (eni_weights_d): Remove switch_cost.
+ 
  2008-01-09  Richard Guenther  <rguenther@suse.de>
  	Andrew Pinski  <andrew_pinski@playstation.sony.com>
  
Index: tree-inline.c
===================================================================
*** tree-inline.c	(revision 131432)
--- tree-inline.c	(working copy)
*************** estimate_num_insns_1 (tree *tp, int *wal
*** 2387,2395 ****
        break;
  
      case SWITCH_EXPR:
!       /* TODO: Cost of a switch should be derived from the number of
! 	 branches.  */
!       d->count += d->weights->switch_cost;
        break;
  
      /* Few special cases of expensive operations.  This is useful
--- 2387,2398 ----
        break;
  
      case SWITCH_EXPR:
!       /* Take into account cost of the switch + guess 2 conditional jumps for
!          each case label.  
! 
! 	 TODO: once the switch expansion logic is sufficiently separated, we can
! 	 do better job on estimating cost of the switch.  */
!       d->count += TREE_VEC_LENGTH (SWITCH_LABELS (x)) * 2;
        break;
  
      /* Few special cases of expensive operations.  This is useful
*************** init_inline_once (void)
*** 2518,2530 ****
    eni_inlining_weights.call_cost = PARAM_VALUE (PARAM_INLINE_CALL_COST);
    eni_inlining_weights.target_builtin_call_cost = 1;
    eni_inlining_weights.div_mod_cost = 10;
-   eni_inlining_weights.switch_cost = 1;
    eni_inlining_weights.omp_cost = 40;
  
    eni_size_weights.call_cost = 1;
    eni_size_weights.target_builtin_call_cost = 1;
    eni_size_weights.div_mod_cost = 1;
-   eni_size_weights.switch_cost = 10;
    eni_size_weights.omp_cost = 40;
  
    /* Estimating time for call is difficult, since we have no idea what the
--- 2521,2531 ----
*************** init_inline_once (void)
*** 2534,2540 ****
    eni_time_weights.call_cost = 10;
    eni_time_weights.target_builtin_call_cost = 10;
    eni_time_weights.div_mod_cost = 10;
-   eni_time_weights.switch_cost = 4;
    eni_time_weights.omp_cost = 40;
  }
  
--- 2535,2540 ----
Index: tree-inline.h
===================================================================
*** tree-inline.h	(revision 131432)
--- tree-inline.h	(working copy)
*************** typedef struct eni_weights_d
*** 115,123 ****
    /* Cost of "expensive" div and mod operations.  */
    unsigned div_mod_cost;
  
-   /* Cost of switch statement.  */
-   unsigned switch_cost;
- 
    /* Cost for omp construct.  */
    unsigned omp_cost;
  } eni_weights;
--- 115,120 ----



More information about the Gcc-patches mailing list