Build this program:
package main
func main() {
f()
}
//go:noinline
func f() int {
return x
}
var x int
Then disassemble main.f:
go tool objdump -s main.f$ test
TEXT main.f(SB) /Users/khr/gowork/test.go
test.go:9 0x100073070 d000065b ADRP 827392(PC), R27
test.go:9 0x100073074 9106237b ADD $392, R27, R27
test.go:9 0x100073078 f9400360 MOVD (R27), R0
test.go:9 0x10007307c d65f03c0 RET
The ADD there is pointless - that constant offset should be folded into the load.
This is happening only at tip. On 1.26.1 and earlier, it is correct:
TEXT main.f(SB) /Users/khr/gowork/test.go
test.go:9 0x100070af0 b000065b ADRP 823296(PC), R27
test.go:9 0x100070af4 f9429760 MOVD 1320(R27), R0
test.go:9 0x100070af8 d65f03c0 RET
test.go:9 0x100070afc 00000000 ?
Next up: binary search for offending CL.
Build this program:
Then disassemble
main.f:The ADD there is pointless - that constant offset should be folded into the load.
This is happening only at tip. On 1.26.1 and earlier, it is correct:
Next up: binary search for offending CL.