A main loop that steps by factor, with the body replicated factor
times (each copy substitutes var with var+offset for offset 0..factor-1).
A cleanup loop that handles the remaining < factor iterations with the
original body. When factor exactly divides the trip count, the cleanup
loop's bounds produce a no-op and it generates no iterations.
If the loop is not a range loop, has an explicit non-unit step, or factor
is ≤ 1, the loop is left unchanged and returned as a single-element array.
Unrolls a range do-loop by the given factor.
Two loops replace the original:
factor, with the body replicatedfactortimes (each copy substitutesvarwithvar+offsetfor offset 0..factor-1).factoriterations with the original body. Whenfactorexactly divides the trip count, the cleanup loop's bounds produce a no-op and it generates no iterations.If the loop is not a range loop, has an explicit non-unit step, or
factoris ≤ 1, the loop is left unchanged and returned as a single-element array.