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: init .autotmp_0 recorded as live on entry #25966
Comments
cc @neelance |
I've investigated this a bit, but I'm not sure on the details of the liveness analysis. @aclements Question: How does
|
"recorded as live on entry" means that the liveness analysis thinks that a pointer contains a meaningful value (is live) when the function begins, before even considering arguments (on entry). In practice, usually this means that you have a "use before assignment/initialization" problem. For most of SSA world, Value order is meaningless. VarDef relates to other values through the memory chain (an ordering implicit by values that have a memory argument and values that have memory type). The schedule pass is responsible for putting values in a good order; it should use the memory chain as part of that. You might want to try running with the SSA check enabled. It can often spot problems in SSA form earlier and help pinpoint them. |
It looks to me that we take the address of
Later,
On other architectures, address operation takes offset, and it is rematerializeable, so it is moved down right before use. However, on Wasm, while |
I am still thinking about which compiler phase is responsible. As far as I understand it is not really wrong to have a |
Yes, I think the generated code is not wrong. It might be possible to change liveness code to not think it live when the address is taken, but until the address is used. I'm not sure. The tricky part is what uses are considered make it live? Load/Store should be. Offset calculation is not, but it needs to propagate the value. Passing address to a Call should make it live. What about Phi? Anything else? |
@cherrymui Are you looking into this further / working on a solution? You already know much more about it than I do and there are a few other wasm issues that I'd like to take care of. |
I'm not working on this right now. I could take a look, maybe tomorrow. I think for Go 1.11 we probably want to have some simple workaround, if possible. If we want to change the liveness code, it's gonna be complicated. As we're late in the freeze, I would suggest not to change the liveness code now, and we can revisit in Go 1.12. |
Change https://golang.org/cl/120599 mentions this issue: |
The following program (reduced from a gosmith-generated one):
crashes the tip compiler when building for
GOARCH=wasm
with optimization disabled:The text was updated successfully, but these errors were encountered: