-
Notifications
You must be signed in to change notification settings - Fork 747
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
Incorrect optimizer result with if parameter #5950
Comments
Looks like a binary parsing error, which I think is because of Binaryen's lack of support for multivalue input params to control flow structures. We should probably error on any such control flow structures? |
@kripken Thanks. An error would have been helpful, yes. When I add the Are there any plans for supporting control flow structure parameters? (I originally wanted to use LLVM's |
Yes, I think "multivalue functions" is meant to indicate that the support is only present for function returns and calls of such functions (and the result of inlining such things). I agree that might not be clear enough. Really we should have an error in the binary parser for this. I'll try to look into that. I think our plan is to support parsing of control flow inputs with the new wasm parser @tlively is working on? That should fix correctness at least, though optimization would take more work. Note that in general this is not a top priority for us as the benefits of such code are minor, 1-2% at best, so there are better things to focus on. |
I wasn't planning on it before, but yes, the new wat parser and associated IRBuilder should make it much more feasible to support parsing multivalue control structures from binary and text. We'll be replacing the input parameters with locals, though, unless we decide to make larger changes to Binaryen IR. |
Before in getType() we silently dropped the params of a signature type. Now we verify that it is none, or we error. Helps #5950
Thanks both, and thanks for the new error! I’ll leave it up to you if you want to leave this issue open. |
Closing this in favor of #6407. |
Before in getType() we silently dropped the params of a signature type. Now we verify that it is none, or we error. Helps WebAssembly#5950
The following program:
is optimized to:
by
and the function body becomes simply
(local.get $0)
withwasmopt -O
.I am surprised by the fact that the
return
andreturn_call
are lifted out of theif
block. This does not happen when thelocal.get $x
is moved inside bothif
alternatives and theif
does not take a parameter.With the original module, the following tests pass, but they fail with the binaryen output, so I think this is a bug:
This is on the current main (16a5993).
The text was updated successfully, but these errors were encountered: