summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-05-02 13:46:53 -0700
committerGitHub <noreply@github.com>2017-05-02 13:46:53 -0700
commit5de55af88eaac818f86eaaec3f686eaede01397e (patch)
treeed896c1336272efa7e191e3675f883ad85ae3a6f /src/wasm/wasm.cpp
parent1f1018564c472b75335bf4bddbf65cfebb226fb0 (diff)
downloadbinaryen-5de55af88eaac818f86eaaec3f686eaede01397e.tar.gz
binaryen-5de55af88eaac818f86eaaec3f686eaede01397e.tar.bz2
binaryen-5de55af88eaac818f86eaaec3f686eaede01397e.zip
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
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp7
1 files changed, 6 insertions, 1 deletions
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();