cmd/compile: similar returns not optimized #32554
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
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 function:
What did you expect to see?
I expected it to be compiled to a move and a return, given that the return value is always the same.
What did you see instead?
Instead, it was compiled to:
I think the compiler should recognize both cases to be the same.
Note: if this function is called from another one, the optimization is applied. For example:
is compiled to
The text was updated successfully, but these errors were encountered: