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: Parallel programming with FORALL?
    ... pattern it knows how to deal with well. ... One oft-cited example is loop unrolling. ... Turns out that with today's compilers and architectures, loop unrolling ... can get in the way of the compiler doing things like ...
    (comp.lang.fortran)
  • Re: Parallel programming with FORALL?
    ... pattern it knows how to deal with well. ... One oft-cited example is loop unrolling. ... Turns out that with today's compilers and architectures, loop unrolling ... can get in the way of the compiler doing things like ...
    (comp.lang.fortran)
  • Re: Optimisation for tight loops...
    ... >> perl) can do loop unrolling and such. ... >> handle such things and optimize them out of a loop or unroll a loop. ... KT> the compiler *could* determine that the body of a loop doesn't do ... KT> (loop unrolling, common subexpression elimination, etc.). ...
    (comp.lang.perl.misc)
  • 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)