From 0dab8853d60e2e61a749b93056faae35e7ec6ce6 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 6 Jan 2020 16:01:38 -0800 Subject: 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 --- src/wasm2js.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') 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(); } -- cgit v1.2.3