-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: simple generics are not inlined #54497
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
Comments
This will be fixed with unified IR. Inlining in this case was disabled to fix a bug. See CL 395854. Closing as a dup of that issue. |
Actually, not closed, but will be fixed soon. |
I think the issue is we severely limited inlining after having so many issues with inlining, shape types, and the non-unified frontend: go/src/cmd/compile/internal/inline/inl.go Line 725 in 57d0551
I'll look into getting this working with unified IR after CL 421821 lands. I think that code probably just needs to be skipped for unified IR mode. |
Change https://go.dev/cl/424775 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?amd64/windows
Even the simplest one-line generic helpers are not inlined, which essentially kills the generic-based modularization approach. The compiler fails to inline and then strength-reduce the resulting code and generates the most generic variant instead. Not only will it severely impact performance, if the helper is called from the inner loop, but can blossom with all sorts of myths regarding Go generics, preventing their further adoption. The latter suggests the issue is more critical than it might initially appear.
What did you do?
Compile with:
go tool compile -S t1.go
What did you expect to see?
TEST $3f, AX
What did you see instead?
caller:
callee:
The text was updated successfully, but these errors were encountered: