Loop splitting

Loop splitting

Loop splitting (or loop peeling) is a compiler optimization 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.

A useful special case is loop peeling, which can simplify a loop with a problematic first (or first few) iteration by performing that iteration separately before entering the loop.

Here is an example of loop peeling. Suppose the original code looks like this:

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

In the above code, only in the 1st iteration is p=10. For all other iterations p=i-1. We get the following after loop peeling:

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

Loop peeling was introduced in gcc in version 3.4.

Further reading

ee also

* Loop unwinding


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Loop unwinding — Loop unwinding, also known as loop unrolling, is a loop transformation technique that attempts optimize a program s execution speed at the expense of its size.The goal of loop unwinding is to increase the programs speed by reducing (or… …   Wikipedia

  • Loop optimization — In compiler theory, loop optimization plays an important role in improving cache performance, making effective use of parallel processing capabilities, and reducing overheads associated with executing loops. Most execution time of a scientific… …   Wikipedia

  • Loop interchange — In compiler theory, loop interchange is the process of exchanging the order of two iteration variables. For example, in the code fragment: for i from 0 to 10 for j from 0 to 20 a [i,j] = i + jloop interchange would result in: for j from 0 to 20… …   Wikipedia

  • Loop dependence analysis — In compiler theory, loop dependence analysis is the task of determining whether statements within a loop body form a dependence, almost always with respect to array access and modification. For a normalized loop: for i1 from l1 to u1 do for i2… …   Wikipedia

  • Loop bin duplicator — A loop bin duplicator is a specialized audio tape machine utilized in the duplication of pre recorded audio cassettes. Analog Loop Bin Duplicator An analog loop bin uses a long loop of 1/2 wide tape loaded in a large bin located in the front of… …   Wikipedia

  • Normalized loop — In computer science, a normalized loop (sometimes called well behaved loop), is a loop which the loop variable starts at 0 (or any constant) and get incremented by one at every iteration until the exit condition is met. Normalized loops are very… …   Wikipedia

  • 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… …   Wikipedia

  • Wellington Urban Motorway — New Zealand motorway motorway= Wellington Urban Motorway image file=Wellington Motorway.jpg image size=225px image caption=The Wellington Urban Motorway in 1994, looking north out of Wellington. The motorway shares a narrow stretch of land with… …   Wikipedia

  • Frequency compensation — In electrical engineering, frequency compensation is a technique used in amplifiers, and especially in amplifiers employing negative feedback. It usually has two primary goals: To avoid the unintentional creation of positive feedback, which will… …   Wikipedia

  • Step response — The step response of a system in a given initial state consists of the time evolution of its outputs when its control inputs are Heaviside step functions. In electronic engineering and control theory, step response is the time behaviour of the… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”