-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: Increasing complexity when inlining #69925
Comments
Also same thing happens with field embeding, i once noticed that binary.NativeEndian has bigger inlining cost than binary.LittleEndian/binary.BigEndian, even though it looks like this: go/src/encoding/binary/native_endian_little.go Lines 9 to 14 in ef3e1da
|
This is a consequence of deciding inlining complexity early in compilation, before we know how many instructions a function will actually take. The wrapper around the inline looks like it would require some cost, even though code generation can eliminate all of that cost. Improvements in this area probably fall under the general umbrella of #61502. |
@randall77 Is there anything specific we should keep this issue for, or shall we just close in favor of the more general #61502? |
Go version
go version go1.23.1 linux/amd64
Output of
go env
in your module/workspace:What did you do?
With the code below the following inlining decisions are made/shown:
godbolt
Although this works, it reduces the chance of something getting inlined, as it increases the complexity of the function something is inlined into, even though the resulting bytecode will/should be identical for all 3 methods (otherwise there would be no inlining).
What did you see happen?
(see above)
What did you expect to see?
Correct me if I'm wrong, but shouldn't these be something like the following, as that's actually what inlining does:
Since inlining effectively reduces the effort/size of a function, these should probably not increase in complexity.
The text was updated successfully, but these errors were encountered: