Please answer these questions before submitting your issue. Thanks!
go version)?tip
yes
go env)?ppc64le Ubuntu 16.04
Inspecting code from compress/flate, noticed some simple functions that I would expect to be inlined that are not.
Functions compress/flate.byLiteral.Len, compress/flate.byLiteral.Less, compress/flate.byLiteral.Swap, compress/flate.byFreq.Len, compress/flate.byFreq.Less, compress/flate.byFreq.Swap inlined as was done in go 1.10.
No inlining for these functions on the latest branch or in go 1.11.
I just built the test in compress/flate and looked at the code. Not sure if you need more information.
I did add the -m=2 option and the output said those functions should be inlined.
../../compress/flate/huffman_code.go:321:6: can inline byLiteral.Len as: method(byLiteral) func() int { return len(s) }
../../compress/flate/huffman_code.go:323:6: can inline byLiteral.Less as: method(byLiteral) func(int, int) bool { return s[i].literal < s[j].literal }
../../compress/flate/huffman_code.go:327:6: can inline byLiteral.Swap as: method(byLiteral) func(int, int) { s[i], s[j] = s[j], s[i] }
../../compress/flate/huffman_code.go:336:6: can inline byFreq.Len as: method(byFreq) func() int { return len(s) }
../../compress/flate/huffman_code.go:338:6: can inline byFreq.Less as: method(byFreq) func(int, int) bool { if s[i].freq == s[j].freq { return s[i].literal < s[j].literal }; return s[i].freq < s[j].freq }
../../compress/flate/huffman_code.go:345:6: can inline byFreq.Swap as: method(byFreq) func(int, int) { s[i], s[j] = s[j], s[i] }
Forgot to mention: they aren't being inlined in the corresponding functions like these:
compress/flate.(byLiteral).Len
compress/flate.(byLiteral).Less
compress/flate.(byLiteral).Swap
compress.flate.(byFreq).Len
compress.flate.(byFreq).Less
compress.flate.(byFreq).Swap
Looks like https://github.com/golang/go/issues/25338
Change https://golang.org/cl/135697 mentions this issue: cmd/compile/internal/gc: inline autogenerated (*T).M wrappers
@laboger if you apply the above fix locally, is the issue resolved? If so, I'll close this as a dupe of #25338
I tried the fix above and the functions are now inlined.
@laboger thank you. Closing as a dupe of #25338.
Most helpful comment
Change https://golang.org/cl/135697 mentions this issue:
cmd/compile/internal/gc: inline autogenerated (*T).M wrappers