IT lexicon › Programming › Loop fission

Loop fission

Programming På svenska → Updated: 2026-11-05

The reverse of loop fusion: a loop doing several independent jobs is split into several loops, each easier to optimise.

Also called loop distribution. The point is to quarantine the awkward part. If one statement carries a dependence between iterations and the rest don't, the rest can be pulled out and vectorised while the tricky bit runs at its own pace. A narrower loop also needs fewer registers, so less gets spilled to the stack.

GCC goes a step further: it recognises a split-off loop that only zeroes or copies memory and replaces it with a call to memset or memcpy. That works beautifully until you compile memset itself and get a function that calls itself forever — which is why glibc and most embedded C libraries build with -fno-tree-loop-distribute-patterns.

← Back to the lexicon