-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: unnecessary zeroing #15914
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
Comments
How often does this trigger? If it can happen on large allocations, this could nearly double the cost of allocation. |
I'm not sure when it happens, exactly. Maybe only escaping local declarations. Something to investigate. |
FWIW, input to SSA is very different.
Bad:
|
Before walk, also before order:
Bad:
"Bad" is "Addable". |
And inputs to "escfunc" in escape analysis are identical. |
Apparent difference appears during escape anaysis:
Bad:
|
Backing up and looking carefully, studying this on amd64 where it is easy, with "good" at 99d29d5 and "bad" at e29e0ba (plus a minor tweak, described below):
With SSA, the extra zeroing always occurs, before and after the problematic CL (https://go-review.googlesource.com/c/23393/).
Here are the differences in generated assembly, with "bad" including the Addable "fix":
With SSA backend, the generated assembly language is nearly identical, differing only in line numbers:
|
CL https://golang.org/cl/27930 mentions this issue. |
This function used to compile to something like:
since the liveness fix (https://go-review.googlesource.com/c/23393/), it now compiles to:
Figure out why the redundant zeroing has been added and then get rid of it.
See #15902 .
The text was updated successfully, but these errors were encountered: