From 6f0f2e00521843118b63f41732dc2eb86d39fa09 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 26 Nov 2024 17:12:15 -0800 Subject: Make more Ifs unreachable (#7094) Previously the only Ifs that were typed unreachable were those in which both arms were unreachable and those in which the condition was unreachable that would have otherwise been typed none. This caused problems in IRBuilder because Ifs with unreachable conditions and value-returning arms would have concrete types, effectively hiding the unreachable condition from the logic for dropping concretely typed expressions preceding an unreachable expression when finishing a scope. Relax the conditions under which an If can be typed unreachable so that all Ifs with unreachable conditions or two unreachable arms are typed unreachable. Propagating unreachability more eagerly this way makes various optimizations of Ifs more powerful. It also requires new handling for unreachable Ifs with concretely typed arms in the Printer to ensure that printed wat remains valid. Also update Unsubtyping, Flatten, and CodeFolding to account for the newly unreachable Ifs. --- test/wasm2js/unreachable-if.2asm.js.opt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/wasm2js/unreachable-if.2asm.js.opt (limited to 'test/wasm2js/unreachable-if.2asm.js.opt') diff --git a/test/wasm2js/unreachable-if.2asm.js.opt b/test/wasm2js/unreachable-if.2asm.js.opt new file mode 100644 index 000000000..f5656223c --- /dev/null +++ b/test/wasm2js/unreachable-if.2asm.js.opt @@ -0,0 +1,19 @@ + +function asmFunc(imports) { + var Math_imul = Math.imul; + var Math_fround = Math.fround; + var Math_abs = Math.abs; + var Math_clz32 = Math.clz32; + var Math_min = Math.min; + var Math_max = Math.max; + var Math_floor = Math.floor; + var Math_ceil = Math.ceil; + var Math_trunc = Math.trunc; + var Math_sqrt = Math.sqrt; + return { + + }; +} + +var retasmFunc = asmFunc({ +}); -- cgit v1.2.3