This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

limit code expnasion on ifcvt


Hi,
I've noticed that my recent change to BIB branch to increase branch cost to 2
caused code growth on average by about 2%.  This patch should solve it by
suppressing code expanding if conversion on non-hot blocks in program.
I think that disabling anything with branch_cost>=2 should do almost well for
most architectures except for VLIW ones where the amortized cost of jump may be
higher.  Any ideas for better interface?

Honza

Sun Nov 17 14:37:06 CET 2002  Jan Hubicka  <jh@suse.cz>
	* ifcvt.c (noce_try_store_flag_constants, noce_try_store_flag_inc,
	noce_try_cmove_arith): Use maybe_hot_bb_p to limit code expansion.
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.103.2.2
diff -c -3 -p -r1.103.2.2 ifcvt.c
*** ifcvt.c	20 Sep 2002 01:29:06 -0000	1.103.2.2
--- ifcvt.c	17 Nov 2002 13:35:21 -0000
*************** noce_try_store_flag_constants (if_info)
*** 759,764 ****
--- 759,766 ----
        reversep = 0;
        if (diff == STORE_FLAG_VALUE || diff == -STORE_FLAG_VALUE)
  	normalize = 0;
+       else if (!maybe_hot_bb_p (if_info->test_bb))
+ 	return FALSE;
        else if (ifalse == 0 && exact_log2 (itrue) >= 0
  	       && (STORE_FLAG_VALUE == 1
  		   || BRANCH_COST >= 2))
*************** noce_try_store_flag_inc (if_info)
*** 869,875 ****
    int subtract, normalize;
  
    if (! no_new_pseudos
!       && (BRANCH_COST >= 2
  	  || HAVE_incscc
  	  || HAVE_decscc)
        /* Should be no `else' case to worry about.  */
--- 871,877 ----
    int subtract, normalize;
  
    if (! no_new_pseudos
!       && ((BRANCH_COST >= 2 && maybe_hot_bb_p (if_info->test_bb))
  	  || HAVE_incscc
  	  || HAVE_decscc)
        /* Should be no `else' case to worry about.  */
*************** noce_try_store_flag_mask (if_info)
*** 933,939 ****
  
    reversep = 0;
    if (! no_new_pseudos
!       && (BRANCH_COST >= 2
  	  || STORE_FLAG_VALUE == -1)
        && ((if_info->a == const0_rtx
  	   && rtx_equal_p (if_info->b, if_info->x))
--- 935,941 ----
  
    reversep = 0;
    if (! no_new_pseudos
!       && ((BRANCH_COST >= 2 && maybe_hot_bb_p (if_info->test_bb))
  	  || STORE_FLAG_VALUE == -1)
        && ((if_info->a == const0_rtx
  	   && rtx_equal_p (if_info->b, if_info->x))
*************** noce_try_cmove_arith (if_info)
*** 1093,1099 ****
       already checked for no side effects.  */
    if (! no_new_pseudos && cse_not_expected
        && GET_CODE (a) == MEM && GET_CODE (b) == MEM
!       && BRANCH_COST >= 5)
      {
        a = XEXP (a, 0);
        b = XEXP (b, 0);
--- 1095,1102 ----
       already checked for no side effects.  */
    if (! no_new_pseudos && cse_not_expected
        && GET_CODE (a) == MEM && GET_CODE (b) == MEM
!       && BRANCH_COST >= 5
!       && maybe_hot_bb_p (if_info->test_bb))
      {
        a = XEXP (a, 0);
        b = XEXP (b, 0);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]