PR tree-optimization/34708 (too much inlining)

Jan Hubicka jh@suse.cz
Tue Jan 8 13:04:00 GMT 2008


Hi,
the testcase involves a lot of inlining because quite large SWITCH statement
cost is underestimated.  This patch fixes it by assuming two conditionals for
each SWITCH label.

Bootstrapped/regtested i686-linux, OK?

Honza

	PR tree-optimization/34708
	* tree-inline.c (estimate_num_insns_1): Compute SWITCH cost based on
	number of case labels.
Index: tree-inline.c
===================================================================
*** tree-inline.c	(revision 131386)
--- 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,2400 ----
        break;
  
      case SWITCH_EXPR:
!       /* Take into account cost of the switch + guess 2 conditional jumps for
!          each case label.
!      
! 	 TODO: once switch expansion algorithm is sufficiently separated
! 	 from RTL expansion, we might ask it for real cost of the switch
! 	 construct.  */
!       d->count += (d->weights->switch_cost
! 		   + TREE_VEC_LENGTH (SWITCH_LABELS (x)) * 2);
        break;
  
      /* Few special cases of expensive operations.  This is useful



More information about the Gcc-patches mailing list