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]

[rtlopt] fix updating of profile in vpt


Hi,
I've commited the attached patch to emit proper jump insns.
We should probably create new do_compare_rtx_and_jump to be used in
optimization passes requiring probability and updating labels to avoid
such problems in future, but I don't have time to do so right now.
Also in last case we are probably able to derrive better value from the
histogram.

Honza

Index: ChangeLog.rtlopt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.rtlopt,v
retrieving revision 1.1.2.64
diff -c -3 -p -r1.1.2.64 ChangeLog.rtlopt
*** ChangeLog.rtlopt	23 Dec 2002 18:40:30 -0000	1.1.2.64
--- ChangeLog.rtlopt	27 Dec 2002 22:02:47 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ Fri Dec 27 22:59:18 CET 2002  Jan Hubicka  <jh@suse.cz>
+ 
+ 	* vpt.c (gen_divmod_fixed_value,  gen_mod_pow2, gen_mod_subtract):
+ 	Set probability of the new jump.
+ 
  Mon Dec 23 19:39:34 CET 2002  Jan Hubicka  <jh@suse.cz>
  
  	* toplev.c (rest_of_compilation): Form superblocks just before the scheduling.
Index: vpt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/vpt.c,v
retrieving revision 1.1.2.4
diff -c -3 -p -r1.1.2.4 vpt.c
*** vpt.c	8 Dec 2002 14:36:40 -0000	1.1.2.4
--- vpt.c	27 Dec 2002 22:02:46 -0000
*************** gen_divmod_fixed_value (mode, operation,
*** 347,352 ****
--- 347,353 ----
    rtx neq_label = gen_label_rtx ();
    rtx end_label = gen_label_rtx ();
    rtx sequence;
+   rtx jump;
  
    start_sequence ();
    
*************** gen_divmod_fixed_value (mode, operation,
*** 360,365 ****
--- 361,370 ----
  
    do_compare_rtx_and_jump (tmp, GEN_INT (value), NE, 0, mode, NULL_RTX,
  			   NULL_RTX, neq_label);
+   jump = get_last_insn ();
+   REG_NOTES (jump)
+ 	  = gen_rtx_EXPR_LIST (REG_BR_PROB,
+ 			       GEN_INT (REG_BR_PROB_BASE / 100), REG_NOTES (jump));
    tmp1 = simplify_gen_binary (operation, mode, copy_rtx (op1), GEN_INT (value));
    tmp1 = force_operand (tmp1, target);
    if (tmp1 != target)
*************** gen_mod_pow2 (mode, operation, target, o
*** 459,464 ****
--- 464,470 ----
    rtx neq_label = gen_label_rtx ();
    rtx end_label = gen_label_rtx ();
    rtx sequence;
+   rtx jump;
  
    start_sequence ();
    
*************** gen_mod_pow2 (mode, operation, target, o
*** 476,481 ****
--- 482,491 ----
  			      0, OPTAB_WIDEN);
    do_compare_rtx_and_jump (tmp2, const0_rtx, NE, 0, mode, NULL_RTX,
  			   NULL_RTX, neq_label);
+   jump = get_last_insn ();
+   REG_NOTES (jump)
+ 	  = gen_rtx_EXPR_LIST (REG_BR_PROB,
+ 			       GEN_INT (REG_BR_PROB_BASE / 100), REG_NOTES (jump));
    tmp3 = expand_simple_binop (mode, AND, op1, tmp1, target,
  			      0, OPTAB_WIDEN);
    if (tmp3 != target)
*************** gen_mod_subtract (mode, operation, targe
*** 580,585 ****
--- 590,596 ----
    rtx tmp, tmp1;
    rtx end_label = gen_label_rtx ();
    rtx sequence;
+   rtx jump;
    int i;
  
    start_sequence ();
*************** gen_mod_subtract (mode, operation, targe
*** 595,600 ****
--- 606,617 ----
    emit_move_insn (target, copy_rtx (op1));
    do_compare_rtx_and_jump (target, tmp, LTU, 0, mode, NULL_RTX,
  			   NULL_RTX, end_label);
+   jump = get_last_insn ();
+   REG_NOTES (jump)
+ 	  = gen_rtx_EXPR_LIST (REG_BR_PROB,
+ 			       GEN_INT (REG_BR_PROB_BASE
+ 					- REG_BR_PROB_BASE / 100),
+ 			       REG_NOTES (jump));
    
  
    for (i = 0; i < sub; i++)
*************** gen_mod_subtract (mode, operation, targe
*** 605,610 ****
--- 622,633 ----
  	emit_move_insn (target, tmp1);
        do_compare_rtx_and_jump (target, tmp, LTU, 0, mode, NULL_RTX,
      			       NULL_RTX, end_label);
+       jump = get_last_insn ();
+       REG_NOTES (jump)
+ 	      = gen_rtx_EXPR_LIST (REG_BR_PROB,
+ 				   GEN_INT (REG_BR_PROB_BASE
+ 				     	    - REG_BR_PROB_BASE / 100),
+ 				   REG_NOTES (jump));
      }
  
    tmp1 = simplify_gen_binary (operation, mode, copy_rtx (target), copy_rtx (tmp));


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