Skip to content
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/compile: Unnecessary copies of local variables in equality checks #59655

Closed
merykitty opened this issue Apr 16, 2023 · 3 comments
Closed
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge Performance
Milestone

Comments

@merykitty
Copy link

Does this issue reproduce with the latest release?

Yes

What did you do?

https://godbolt.org/z/snnP3KWv7

What did you expect to see?

The 2 functions should do the same and just take the addresses of the local variables to invoke type..eq."".Bar.

What did you see instead?

The naive one creates 2 temporaries, then takes the addresses of those to invoke type..eq."".Bar, while the *& version does the expected operations.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Apr 16, 2023
@randall77 randall77 added this to the Unplanned milestone Apr 16, 2023
@cuonglm
Copy link
Member

cuonglm commented Apr 17, 2023

CL https://go-review.googlesource.com/c/go/+/419234 fixed this, could not reproduce with go1.20 and tip.

@merykitty
Copy link
Author

Thanks, in that case, should I close the issue now?

@cuonglm
Copy link
Member

cuonglm commented Apr 17, 2023

Thanks, in that case, should I close the issue now?

Sure.

@cuonglm cuonglm closed this as completed Apr 17, 2023
@golang golang locked and limited conversation to collaborators Apr 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge Performance
Projects
None yet
Development

No branches or pull requests

4 participants