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: internal compiler error: (...) value ~R0 (v85) incorrectly live at entry #62211
Comments
Bisects to 59037ac (https://go-review.googlesource.com/c/go/+/517775) |
Thanks for the report. |
Simplified test case: https://go.dev/play/p/SPdDcqGaA9C?v=gotip The issue is the new deadcode elimination identifies
into just:
This then causes the inliner to trigger special optimizations for functions with a single "return" statement, which then seems to cause confusion for phi insertion during ssagen, because the result parameter (internally named |
Change https://go.dev/cl/522096 mentions this issue: |
In go.dev/cl/517775, I moved the frontend's deadcode elimination pass into unified IR. But I also made a small enhancement: a branch like "if x || true" is now detected as always taken, so the else branch can be eliminated. However, the inliner also has an optimization for delaying the introduction of the result temporary variables when there's a single return statement (added in go.dev/cl/266199). Consequently, the inliner turns "if x || true { return true }; return true" into: if x || true { ~R0 := true goto .i0 } .i0: // code that uses ~R0 In turn, this confuses phi insertion, because it doesn't recognize that the "if" statement is always taken, and so ~R0 will always be initialized. With this CL, after inlining we instead produce: _ = x || true ~R0 := true goto .i0 .i0: Fixes golang#62211. Change-Id: Ic8a12c9eb85833ee4e5d114f60e6c47817fce538 Reviewed-on: https://go-review.googlesource.com/c/go/+/522096 Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Building this reproduction program https://go.dev/play/p/DF9uLw2Vrs9?v=gotip results in this internal compiler error:
The text was updated successfully, but these errors were encountered: