Add a pass to remove exports from the WASM bundle
This is helpful when e.g. there's a WASM shared library with all possible functions exported but the application only needs a subset of those exports. Removing exports in that case will enable further optimizers to remove more code from the file.
@kripken based on my tests the pass is executed before passes for removing dead code, but I wasn't sure if that's just coincident or a stable behavior. Could you confirm if that's the case (otherwise users would have to call wasm-opt twice to get all the optimizations) or is there anything I could do to make this explicit? Many thanks.
Before getting into details here, please see this wiki page:
https://github.com/WebAssembly/binaryen/wiki/Pruning-unneeded-code-in-wasm-files-with-wasm-metadce#example-pruning-exports
wasm-metadce can prune exports, perhaps that is enough for your use case?
Thanks for sharing. This sort of solves the problem I'm trying to solve; one difference here is that for wasm-metadce you need to define reachable nodes, whereas this pass does it other way around (you define exports that you don't need). I think it's a bit more scripting to define all reachable functions in my case, but I can definitely live with that. Up to you then whether you want to merge it or close.
I see, thanks. I don't feel strongly, then, since it somewhat different. Maybe let's keep it open and see if other people comment that they could benefit as well - if so, I think we should land it.