summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-01-06 16:01:38 -0800
committerGitHub <noreply@github.com>2020-01-06 16:01:38 -0800
commit0dab8853d60e2e61a749b93056faae35e7ec6ce6 (patch)
tree6884d42f748e332d7ca3e813d655149b88fdf717 /src
parent44c3c2d4e71686d42b7eff8ab9c554f83a9fe71e (diff)
downloadbinaryen-0dab8853d60e2e61a749b93056faae35e7ec6ce6.tar.gz
binaryen-0dab8853d60e2e61a749b93056faae35e7ec6ce6.tar.bz2
binaryen-0dab8853d60e2e61a749b93056faae35e7ec6ce6.zip
DCE at the end of wasm2js (#2574)
By doing so we ensure that our calls to convert wasm types to JS types never try to convert an unreachable. Fixes #2558
Diffstat (limited to 'src')
-rw-r--r--src/wasm2js.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h
index 1adde23b8..398b81f43 100644
--- a/src/wasm2js.h
+++ b/src/wasm2js.h
@@ -329,6 +329,9 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) {
runner.add("reorder-locals");
runner.add("vacuum");
runner.add("remove-unused-module-elements");
+ // DCE at the end to make sure all IR nodes have valid types for conversion
+ // to JS, and not unreachable.
+ runner.add("dce");
runner.setDebug(flags.debug);
runner.run();
}