patch applied to loop.c

Joern Rennecke amylaar@cygnus.co.uk
Wed Jun 30 23:15:00 GMT 1999


Reviewed by Jeffrey Law.

Thu Jun 17 17:22:07 1999  J"orn Rennecke <amylaar@cygnus.co.uk>

	* loop.c (strength_reduce): When doing biv->giv conversion, fix up
	reg_biv_class.

	(recombine_givs): Set ix field after sorting.

Index: loop.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/loop.c,v
retrieving revision 1.162
diff -p -r1.162 loop.c
*** loop.c	1999/06/16 11:46:14	1.162
--- loop.c	1999/06/17 16:21:23
*************** strength_reduce (scan_start, end, loop_t
*** 4058,4063 ****
--- 4058,4064 ----
  		fprintf (loop_dump_stream, "is giv of biv %d\n", bl2->regno);
  	      /* Let this giv be discovered by the generic code.  */
  	      REG_IV_TYPE (bl->regno) = UNKNOWN_INDUCT;
+ 	      reg_biv_class[bl->regno] = NULL_PTR;
  	      /* We can get better optimization if we can move the giv setting
  		 before the first giv use.  */
  	      if (dominator
*************** strength_reduce (scan_start, end, loop_t
*** 4109,4115 ****
  		}
  	      /* Remove this biv from the chain.  */
  	      if (bl->next)
! 		*bl = *bl->next;
  	      else
  		{
  		  *backbl = 0;
--- 4110,4122 ----
  		}
  	      /* Remove this biv from the chain.  */
  	      if (bl->next)
! 		{
! 		  /* We move the following giv from *bl->next into *bl.
! 		     We have to update reg_biv_class for that moved biv
! 		     to point to its new address.  */
! 		  *bl = *bl->next;
! 		  reg_biv_class[bl->regno] = bl;
! 		}
  	      else
  		{
  		  *backbl = 0;
*************** recombine_givs (bl, loop_start, loop_end
*** 7190,7205 ****
        for (p = v->insn; INSN_UID (p) >= max_uid_for_loop; )
  	p = PREV_INSN (p);
        stats[i].start_luid = INSN_LUID (p);
-       v->ix = i;
        i++;
      }
  
    qsort (stats, giv_count, sizeof(*stats), cmp_recombine_givs_stats);
  
!   /* Do the actual most-recently-used recombination.  */
    for (last_giv = 0, i = giv_count - 1; i >= 0; i--)
      {
        v = giv_array[stats[i].giv_number];
        if (v->same)
  	{
  	  struct induction *old_same = v->same;
--- 7197,7214 ----
        for (p = v->insn; INSN_UID (p) >= max_uid_for_loop; )
  	p = PREV_INSN (p);
        stats[i].start_luid = INSN_LUID (p);
        i++;
      }
  
    qsort (stats, giv_count, sizeof(*stats), cmp_recombine_givs_stats);
  
!   /* Set up the ix field for each giv in stats to name
!      the corresponding index into stats, and
!      do the actual most-recently-used recombination.  */
    for (last_giv = 0, i = giv_count - 1; i >= 0; i--)
      {
        v = giv_array[stats[i].giv_number];
+       v->ix = i;
        if (v->same)
  	{
  	  struct induction *old_same = v->same;



More information about the Gcc-patches mailing list