From 5de55af88eaac818f86eaaec3f686eaede01397e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 2 May 2017 13:46:53 -0700 Subject: improve dce to handle more cases of nested unreachable code (#989) * improve dce to handle more cases of nested unreachable code, in particular, when the child is unreachable in type but not an actual Unreachable node, e.g. if it's a br. in that case, we just need to verify that the br is not to us where we are a block or loop * handle unreachable switch conditions in dce * handle dce of br condition which is unreachable, and host arguments * handle dce of block i32 etc. which is actually unreachable --- src/wasm/wasm.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/wasm/wasm.cpp') diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index a983fc943..36eff681f 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -409,7 +409,12 @@ void Host::finalize() { break; } case GrowMemory: { - type = i32; + // if the single operand is not reachable, so are we + if (operands[0]->type == unreachable) { + type = unreachable; + } else { + type = i32; + } break; } default: abort(); -- cgit v1.2.3