Run binaryen wasm-opt on wasm backend output #6029
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This proposes we run the binaryen optimizer on wasm-backend output. It makes that output 5-10% smaller. This came up again today when looking at the clang running in the browser demo, which is from the wasm backend, and part of the reason for the large size is not running binaryen opts.
Debatable whether this makes sense to do by default or not - in -O1 and above it shrinks the output but increases build time, it's a tradeoff - but I lean towards emcc doing what emits good code. That clang build is adding binaryen to the build process, but emcc could do it by default so other people don't miss it. Also, there is no change to the speed of -O0 builds for fast iteration.
This PR also contains some closure fixes I noticed when running the test suite locally. I'm surprised these weren't noticed on the bots, maybe they don't have java and so skip closure, I guess?