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]

Re: RFC: PATCH to unroll_loop for optimization/10171


Does this seem safe to other people?  It passes a full bootstrap and check.

2003-03-21  Jason Merrill  <jason at redhat dot com>

	PR optimization/10171
	* unroll.c (ujump_to_loop_cont): Look for a jump to the last label
	between loop->cont and loop->end, not just one at loop->cont.
	(unroll_loop): Adjust call.

*** gcc/unroll.c.~1~	2003-03-10 11:45:17.000000000 -0500
--- gcc/unroll.c	2003-03-21 19:41:59.000000000 -0500
*************** static rtx remap_split_bivs PARAMS ((str
*** 217,223 ****
  static rtx find_common_reg_term PARAMS ((rtx, rtx));
  static rtx subtract_reg_term PARAMS ((rtx, rtx));
  static rtx loop_find_equiv_value PARAMS ((const struct loop *, rtx));
! static rtx ujump_to_loop_cont PARAMS ((rtx, rtx));
  
  /* Try to unroll one loop and split induction variables in the loop.
  
--- 217,223 ----
  static rtx find_common_reg_term PARAMS ((rtx, rtx));
  static rtx subtract_reg_term PARAMS ((rtx, rtx));
  static rtx loop_find_equiv_value PARAMS ((const struct loop *, rtx));
! static rtx ujump_to_loop_cont PARAMS ((rtx, rtx, rtx));
  
  /* Try to unroll one loop and split induction variables in the loop.
  
*************** unroll_loop (loop, insn_count, strength_
*** 305,311 ****
  	 jump to the loop condition.  Make sure to delete the jump
  	 insn, otherwise the loop body will never execute.  */
  
!       rtx ujump = ujump_to_loop_cont (loop->start, loop->cont);
        if (ujump)
  	delete_related_insns (ujump);
  
--- 305,311 ----
  	 jump to the loop condition.  Make sure to delete the jump
  	 insn, otherwise the loop body will never execute.  */
  
!       rtx ujump = ujump_to_loop_cont (loop->start, loop->cont, last_loop_insn);
        if (ujump)
  	delete_related_insns (ujump);
  
*************** set_dominates_use (regno, first_uid, las
*** 4045,4053 ****
     deleted so that we execute the single iteration.  */
  
  static rtx
! ujump_to_loop_cont (loop_start, loop_cont)
       rtx loop_start;
       rtx loop_cont;
  {
    rtx x, label, label_ref;
  
--- 4045,4054 ----
     deleted so that we execute the single iteration.  */
  
  static rtx
! ujump_to_loop_cont (loop_start, loop_cont, loop_end)
       rtx loop_start;
       rtx loop_cont;
+      rtx loop_end;
  {
    rtx x, label, label_ref;
  
*************** ujump_to_loop_cont (loop_start, loop_con
*** 4062,4070 ****
    if (!label_ref)
      return NULL_RTX;
  
!   /* Examine insn after loop continuation note.  Return if not a label.  */
!   label = next_nonnote_insn (loop_cont);
!   if (label == 0 || GET_CODE (label) != CODE_LABEL)
      return NULL_RTX;
  
    /* Return the loop start if the branch label matches the code label.  */
--- 4063,4075 ----
    if (!label_ref)
      return NULL_RTX;
  
!   /* Find the label nearest the end.  */
!   loop_cont = next_nonnote_insn (loop_cont);
!   for (label = loop_end; label != loop_cont; label = prev_nonnote_insn (label))
!     if (GET_CODE (label) == CODE_LABEL)
!       break;
!   
!   if (GET_CODE (label) != CODE_LABEL)
      return NULL_RTX;
  
    /* Return the loop start if the branch label matches the code label.  */

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