Loop reg scan patch resubmission

Michael Hayes mhayes@redhat.com
Sat Jan 6 19:39:00 GMT 2001


Richard Henderson writes:

 > > !       /* Zero the new elements.  */
 > > !       memset (regs->array + old_nregs, 0,
 > > ! 	      (regs->size - old_nregs) * sizeof (*regs->array));
 > > !     }
 > >   
 > > !   if (old_nregs)
 > > !     {
 > > !       /* Clear fields that are scanned.  Don't alter n_times_set
 > > ! 	 for previously scanned registers.  */
 > > !       for (i = 0; i < regs->num; i++)
 > 
 > We just zeroed the new elements.  We don't need to loop over them
 > zeroing things again.

OK, I was playing safe.  I'll commit the patch with the following
modification.  Interestingly, when compiling gcc (for
i686-pc-linux-gnu) the array never needs resizing so the gain won't be
startling :-)

-       for (i = 0; i < regs->num; i++)
+       for (i = 0; i < old_nregs; i++)

Michael.


More information about the Gcc-patches mailing list