Skip to content

Emscripten's use of wasm-opt #5598

Answered by tlively
jlb6740 asked this question in Q&A
Mar 28, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

The wasm-opt invoked by Emscripten is the exact same as the standalone wasm-opt from this repo. Generally if you pass e.g. -O2 to Emscripten, it will pass -O2 to both clang (at compile time) and wasm-opt (at link time), so the optimization pipelines are the same as well, besides additional passes Emscripten might run such --post-emscripten. You can tell emcc to run extra binaryen passes with the -sBINARYEN_EXTRA_PASSES=... setting.

You can see the precise exception optimizations the --post-emscripten pass here: https://github.com/WebAssembly/binaryen/blob/main/src/passes/PostEmscripten.cpp#L249-L341. Notably, this only applies to Emscripten exceptions, which call out to JS to do try-catch…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jlb6740
Comment options

@kripken
Comment options

Answer selected by jlb6740
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants