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 copy in regalloc #44670

Open
josharian opened this issue Feb 27, 2021 · 0 comments
Open

cmd/compile: unnecessary copy in regalloc #44670

josharian opened this issue Feb 27, 2021 · 0 comments

Comments

@josharian
Copy link
Contributor

@josharian josharian commented Feb 27, 2021

After CLs 297049 and 297050, generate code for shrVU_g in math/big.

The result includes these two instructions:

v121 00026 (+181) LEAQ 1(R10), R8
v107 00027 (181) MOVQ R8, CX

After this, R8 is dead. So this could have just been one instruction, LEAQ 1(R10), CX. Here's the relevant block after regalloc:

Screen Shot 2021-02-27 at 11 36 04 AM

This is the sort of thing a peephole pass could help with (#15300), but maybe now that Values have Uses counts there's a way to detect and improve this in regalloc directly.

cc @randall77 @cherrymui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants