-
Notifications
You must be signed in to change notification settings - Fork 707
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
Run (basic) StackIR optimizations in all binary writes? #6509
Comments
This makes sense to me. Unconditionally running StackIR could also motivate us to pay more attention to it. |
One issue I noticed now is that the StackIR binary writing path does not support DWARF and source maps. Making it support DWARF looks trivial since that information is only used as a single bool, but I don't know how much work source maps would be. edit: this has been fixed in #6564 |
kripken
added a commit
that referenced
this issue
May 1, 2024
Helping #6509, this fixes debugging support for StackIR, which makes it more possible to use StackIR in more places. The fix is basically just to pass around some more state, and then to call the parent with "please write debug info" at the correct times, mirroring the similar calls in BinaryenIRWriter. The relevant Emscripten tests pass, and the source map test modified here produces identical output in StackIR and non-StackIR modes (the test is also simplified to remove --new-wat-parser which is no longer needed, after which the test can clearly show that StackIR has the same output as BinaryenIR).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Atm we enable StackIR optimizations in
-O3
and-Os
and above. This made sense because their benefit is usually fairly small, around 1-2%, and we didn't want to slow down builds just for that. However, maybe it is worth changing that, for two reasons:wasm-opt
in debug builds and even in-O1
(it only runs in-O2+
), and other toolchains likewise have fast iteration/debug builds that just skipwasm-opt
entirely. Ifwasm-opt
is only run when it is meant to optimize, then there is little harm in running StackIR opts.StackIR does have some slower optimizations, which could be enabled only when the user requests a higher optimization level, which the binary writer would check.
(context: #6390 and another approach I am trying to fix that same problem as that PR may end up adding more roundtrip artifacts in rare cases, so I was wondering about ways to mitigate that.)
The text was updated successfully, but these errors were encountered: