cmd/compile: elimination of unused runtime calls #17216
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
This is mostly fixed on tip. It now compiles to:
This is mostly due to https://go-review.googlesource.com/c/29373/ which inlines convT2E.
Thanks @randall77 - yes, the current tip seems to be optimizing that. However if I change function signature from
results become less appealing (compiled using current tip):
And there is also map[type]type case (also compiled using current tip):
As far as I could tell - map doesn't have any "side effects" with user code (it's not truly side effect free tho), so if map is unused, it's creation can be eliminated if no functions were called during map creation. Same goes for
Or am I missing something here? Should I open another issue, btw?