emscripten-core / emscripten-core/emscripten
wasm-split utilizing DCE
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
We have a complex app for which currently supported `profile guided` way of wasm split is not possible. However, we were thinking of utilizing DCE to get all functions to keep.
Our app has exposed some APIs from the c++ code. We want all functions related to only some of the APIs to present in primary module, rest all can go in the secondary module. We created two builds, one with all APIs(full build) and one with APIs that are only supposed to go in primary module(profile build). Then, with the help of emitted symbol map of profiling build, we listed all the functions that need to be kept in the primary module and passed it for `--keep-funcs` wasm-split cmd arg. Split done this way worked really well with no optimization (e.g. `-O0`) but with `-O3` we started to notice some functions required for the primary module APIs that are there in the full build but not in the profile build. We also tried with building full build with `-O3` and profile build with `-O0` to remove function inlining cases but issue was still not solved.
Do you think this approach to wasm-split is feasible? If yes, what can be done to solve the above mentioned issue?
Contributor guide
Assessment
This issue has not been assessed yet.