Loop unrolling

Nathan Myers ncm@nospam.cantrip.org
Fri Sep 18 21:46:00 GMT 1998


Jeffrey A Law wrote:

>   > 2) Determining whether a loop is empty or not needs some kind of
>   >    register lifetime information.  Last I looked, this was not
>   >    reliable at the time of loop unrolling.  If this is no longer true,
>   >    then I can resurrect some code to do this.
> Maybe I misunderstood the kinds of loops people wanted to eliminate.
> I thought if they were empty there was nothing but an increment of
> the counter, and a condjump back to the counter increment.

Generally the kinds of "empty" loops that show up in template 
expansions look something like:

  for (i = 0; i < 0; ++i) *p++ = *q++;

or probably more frequently
   
  for (i = 0; i < 10; ++i, ++p) { if (p); }

Nathan Myers
ncm@cantrip.org



More information about the Gcc mailing list