Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upOptimize emscripten targets with emcc #36899
Comments
brson
added
the
E-help-wanted
label
Oct 1, 2016
This comment has been minimized.
This comment has been minimized.
|
Some optimization levels in emcc seem to disable exception handling, so we might need to be careful about exactly what we're telling emcc to do. |
This comment has been minimized.
This comment has been minimized.
Thinkofname
commented
Oct 1, 2016
|
|
This comment has been minimized.
This comment has been minimized.
|
Actually we do need to continue optimizing our IR. emcc won't do it for us. |
This comment has been minimized.
This comment has been minimized.
|
@Thinkofname Emscripten's current handling of exceptions is horrendous: it injects a try/catch block into almost every function. V8's optimizing compiler bails out on try/catch and other JS engines don't do well either. So you basically need to disable LLVM-level exception handling if you want good performance on emscripten. Fortunately, I believe (not tested!) that a workaround exists: lower This is really an Emscripten bug. Perhaps someone could write a patch? |
brson commentedOct 1, 2016
With today's asmjs and wasm targets, we optimize the LLVM IR ourselves, and pass that IR to emcc. emcc has its own optimization options though, including but not limited to LLVM's optimization passes, so we should probably leave all optimizations to emcc. Likewise LTO should be delegated to emscripten.
So we need to change the backend to treat these targets as unoptimized in LLVM, and instead pass the optimization arguments to emcc during the "link" step. This may involve adding new features to the target spec, or possibly just special casing emscripten in the backend.