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: missed peephole optimizations #10637
Labels
Comments
brtzsnr
changed the title
Missed peephole optimization for shifting
Missed peephole optimizations
Apr 30, 2015
/cc @randall77 for SSA |
josharian
changed the title
Missed peephole optimizations
cmd/internal/gc: missed peephole optimizations
Apr 30, 2015
Yes, this will be easy in SSA. Planned for 1.6. |
ianlancetaylor
changed the title
cmd/internal/gc: missed peephole optimizations
cmd/compile: missed peephole optimizations
Sep 3, 2015
CL https://golang.org/cl/19106 mentions this issue. |
gopherbot
pushed a commit
that referenced
this issue
Feb 4, 2016
Add rewrite rules to optimize constant shifts. Fixes #10637 Change-Id: I74b724d3e81aeb7098c696d02c050f7fdfd5b523 Reviewed-on: https://go-review.googlesource.com/19106 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Todd Neal <todd@tneal.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This is fixed on tip SSA. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The generated assembly is:
S16 should generate a single right shift (SHRQ), not three. Moreover,
SHRQ $0, BX
is a nop and shouldn't be generated at all. Same goes for SHLQ, ADDQ, SUBQ.For multiplication is a bit better, but deadstores are not detected.
Generates the following assembly:
Multiplication with 0 is eliminated, but the dead stores are not.
Multiplication with 1 is eliminated, but the two multiplications by 8 are not coalesced.
Everything was build with the latest version.
The text was updated successfully, but these errors were encountered: