Loop splitting

Uses your system voice; voice and rate in settings.

Snapshot

≈ 1 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

Loop splitting 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.

Loop splitting 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. ==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 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 (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 This equivalent form eliminates the need for the variable p inside the loop body. Loop peeling was introduced in gcc in version 3.4. More generalised loop splitting was added in GCC 7.

Text derived from https://en.wikipedia.org/w/index.php?oldid=1309574487 under CC BY-SA 4.0; modifications have been made.

Provenance

snapshot enwiki-001309574487 · captured 1757015548.0 · version history

Cite this page as: encyclopegia.org, “Loop splitting”, snapshot enwiki-001309574487. https://encyclopegia.org/a/loop-splitting