Closed
Description
It's confusing, especially to assembly writers, when obj package reorders their instructions from under them. It also interferes with any instruction layout done earlier in the compiler, e.g. SSA scheduling.
It may be as simple as removing the Follow pass from cmd/internal/obj/plist.go (and all the associated code for each arch).
The follow pass does the following optimization: for unconditional branches, copy a few instructions from the destination instead of jumping to the copy.
For typical loops, SSA currently generates:
loop:
CMP ...
JGE exit
..loop body..
jmp loop
exit:
The follow pass rewrites this to:
CMP ...
JGE exit
loop:
..loop body..
CMP ...
JLT loop
exit:
We probably want to do this loop head peeling some other way (in SSA?).