Re: Loop unrolling



Tim Frink wrote:
Hi,

what are typical heuristics for loop unrolling, i.e. which constraints
must be satisfied to have a compiler perform unrolling on a particular
loop?

I assume that the loop must not exceed a particular size to avoid a
code size explosion. But are there any other heuristics?

They will be specific to the compiler and loops don't have to be
completely unrolled. For example a loop of 100 may be expanded to a
loop of 20 blocks of 5 repeats.

Some compilers provide a means for tuning loop unrolling as a
space/performance trade off.

--
Ian Collins.
.



Relevant Pages

  • Re: question
    ... SM Ryan wrote: ... > loop unrolling refers to replicating the body of a loop and reducing the total ... So it means that the loop unrooling is the compiler dependent? ...
    (comp.lang.c)
  • Re: question
    ... SM Ryan wrote: ... > loop unrolling refers to replicating the body of a loop and reducing the total ... So it means that the loop unrooling is the compiler dependent? ...
    (comp.lang.c)
  • Re: Duffs Device
    ... It sounds reasonable that the compiler might be optimizing the ... and that loop unrolling would save some time. ... can be done as three sequential adds using two registers, ...
    (comp.lang.fortran)
  • Re: What is the gain of "inline"
    ... where inlining slows down the code. ... I am a firm believer that loop unrolling can cause ... loop body and number of iterations, where a large number of iterations, or a ...
    (comp.lang.c)
  • Re: duffs device / loop unriolling
    ... > register char *t; ... it seems he used loop unrolling to optimize ... Loop unrolling!= Duff's device. ... whether the compiler can do loop unrolling itself, ...
    (comp.lang.c)