Loop splitting
Encyclopedia
Loop splitting is a compiler optimization
Compiler optimization
Compiler optimization is the process of tuning the output of a compiler to minimize or maximize some attributes of an executable computer program. The most common requirement is to minimize the time taken to execute a program; a less common one is to minimize the amount of memory occupied...

 technique. It attempts to simplify a loop or eliminate dependencies by breaking it into multiple loops which have the same bodies but iterate over different contiguous portions of the index range.

Loop peeling

Loop peeling is a special case of loop splitting which splits any problematic first (or last) few iterations from the loop and performs them outside of the loop body.

Suppose a loop was written like this:

int p = 10;
for (int i=0; i<10; ++i)
{
y[i] = x[i] + x[p];
p = i;
}

Notice that p = 10 only for the first iteration, and for all other iterations, p = i - 1. A compiler can take advantage of this by unwinding
Loop unwinding
Loop unwinding, also known as loop unrolling, is a loop transformation technique that attempts to optimize a program's execution speed at the expense of its binary size...

 (or "peeling") the first iteration from the loop.

After peeling the first iteration, the code would look like this:

y[0] = x[0] + x[10];
for (int i=1; i<10; ++i)
{
y[i] = x[i] + x[i-1];
}

This equivalent form eliminates the need for the variable p inside the loop body.

Loop peeling was introduced in gcc
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

in version 3.4.

Brief history of the term

Apparently the term was for the first time used by Cannings, Thompson and Skolnick in their 1976 paper on computational models for (human) inheritance. There the term was used to denote a method for collapsing phenotypic information onto parents. From there the term was used again in their papers, including their seminal paper on probability functions on complex pedigrees.

In compiler technology, the term first turned up in late 1980s papers on VLIW and superscalar compilation, including and.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK