cmd/compile: unnecessary instructions generated #29892
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
I compiled the following code to assembly:
Assembly code generated:
What did you expect to see?
I was expecting the generated code to be much simpler
What did you see instead?
The assembly code shown above has many unnecessary instructions.
A solution I found was to use a named return. When I do that, the assembly code becomes:
In spite of being much better, it also has an extra instruction, the first one, where "out" is being zeroed.
The text was updated successfully, but these errors were encountered: