summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2016-09-28 15:59:26 -0700
committerGitHub <noreply@github.com>2016-09-28 15:59:26 -0700
commit093894012d86673fd6bca304da08ccfba88deb44 (patch)
treeba55d729ab4ab2559907bdbddc1dffc34d41b82c /src
parent2da1b20451a744daa613e818f71e8f52de3a818e (diff)
downloadbinaryen-093894012d86673fd6bca304da08ccfba88deb44.tar.gz
binaryen-093894012d86673fd6bca304da08ccfba88deb44.tar.bz2
binaryen-093894012d86673fd6bca304da08ccfba88deb44.zip
s2wasm: Do not add drops for void values (#718)
Fixes #708
Diffstat (limited to 'src')
-rw-r--r--src/s2wasm.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index 5b7cd1fa4..383ff1e36 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -745,7 +745,11 @@ class S2WasmBuilder {
};
auto setOutput = [&](Expression* curr, Name assign) {
if (assign.isNull() || assign.str[0] == 'd') { // drop
- addToBlock(builder.makeDrop(curr));
+ auto* add = curr;
+ if (isConcreteWasmType(curr->type)) {
+ add = builder.makeDrop(curr);
+ }
+ addToBlock(add);
} else if (assign.str[0] == 'p') { // push
push(curr);
} else { // set to a local