-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: add some code motion optimizations #56620
Comments
CC @golang/compiler |
This looks like a restriction of the tighten pass, where it can't handle moving ops that use memory (a load, in this case). |
Indeed, I didn't see that we already have some code motion optimizations. Thanks @randall77 |
Change https://go.dev/cl/458755 mentions this issue: |
Reopening since I had to revert the CL. |
The failure is due to this assumption being broken: For the failed case, b13 is as follow: So b13 has two incoming memory values. It is broken by CL 478475 @randall77 Does the assumption above still hold? |
My guess is that's a bug in 478475. I'll take a look tomorrow. |
Thanks, this is a reproducer.
|
Fix at CL 492616. @erifan Once that is in, you can retry your CL. |
Ok, thanks. |
Change https://go.dev/cl/492895 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Run the following benchmark:
$ go test -run ^$ -count 5 -bench BenchmarkEfaceEq -cpuprofile cpu.out
The core code is the following lines:
However, the hot-spot instructions for this test are two useless instructions for the test because the test does not go to that code path ( a call to runtime.efaceeq). If we can move these instructions out of the execution path of this test and into another branch, I believe the performance of this test can be greatly improved.
This is just a demo case, I believe there are more places where code motion/sinking optimization is needed. But currently there is no such optimization in Go?
The text was updated successfully, but these errors were encountered: