go version go1.26-devel_e7c0b74a97 Tue Jan 6 20:29:01 2026 +0100 linux/amd64
We do loop rotation extremely late.
Consider this loop:
We will compile to this (pseudo-code):
i := c
goto check
loop:
a()
i--
check:
if i != 0 { goto loop }
The "classical" form would be*:
if c == 0 { goto skip }
i := c
loop:
a()
i--
if i != 0 { goto loop }
skip:
*reversing iteration order of loops isn't classic, but it's not what I want to point out.
We do loop rotation extremely late.
Consider this loop:
We will compile to this (pseudo-code):
The "classical" form would be*:
*reversing iteration order of loops isn't classic, but it's not what I want to point out.