-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: optimize away redundant assignments #597
Labels
Milestone
Comments
ints behave a little bit better. For example, if I do: var a int a = 7 a = 6 ... With 6g I get: 0000 (test.go:11) TEXT main+0(SB),$72-0 0001 (test.go:6) MOVL $0,AX 0002 (test.go:9) MOVL $6,a+-28(SP) ... So the first MOV isn't optimized away, but the one for a = 7 is. It wouldn't be for a float. It also seems strange that the MOVs are using different destinations, but that's probably a separate issue. |
I have a fix pending for the integer case, which can be done by the optimizer. The floating point case is more difficult: it really needs to be done during code generation. That may happen with some analysis that is planned, but it's not trivial. It may be ready for Go 1.1 but may not. Labels changed: added go1.1maybe, removed go1.1. |
Fixed by the new SSA backend. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: