-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/link: potential deadcode elimination opportunity of unused methods #38685
Comments
We probably could do that. I'm thinking on reworking the linker's live method analysis. I'll keep this in mind. I think the compiler needs to emit some kind of marker at The question is how frequently this will fire, i.e. how many methods we can eliminate by doing this. But, most importantly, as a cat person, I oppose removing the |
Also for the following example, I expect the Fish's Meow and Bark should be removed.
|
We at u-root are very interested in this. |
@rojer Have you tried the tip version of Go? I made some improvements in the dev.link branch which is merged a few days ago. Does that make any difference? Thanks. |
@cherrymui looks like there's been a minor improvement since 1.15:
big step down from 1.14 is the unused methods DCE: 1.15 shipped with the fix for #36021 |
This looks to be fixed on tip:
Marking this bug closed -- please reopen if you disagree. Thanks. |
doesn't seem to work across package boundaries,
source:
|
@thanm should i file a new issue for this? |
Yes, please file a new issue. There are many different flavors/permutations/combinations when it comes to unused method removal; the details matter. |
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
)?go env
OutputWhat did you do?
https://play.golang.org/p/lNId1c5z_Dk
What did you expect to see?
should output nothing.
What did you see instead?
Gccgo has the remaining
Meow
too. But tinygo successfully removes the method.Related to #6853 and #36313
Also found https://aykevl.nl/2018/12/tinygo-interface, which might be of interest.
The text was updated successfully, but these errors were encountered: