summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-12-05 21:25:50 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-12-05 21:25:50 -0800
commit5c3a102d7476b2200787aa66a84175bb47862c36 (patch)
treedfcb1a4788ce8b89050e939472a4732a6ff9d811 /src
parent9722b016a63726cc790fb3db38d7bb7503c9bf27 (diff)
downloadbinaryen-5c3a102d7476b2200787aa66a84175bb47862c36.tar.gz
binaryen-5c3a102d7476b2200787aa66a84175bb47862c36.tar.bz2
binaryen-5c3a102d7476b2200787aa66a84175bb47862c36.zip
avoid unnecessary return
Diffstat (limited to 'src')
-rw-r--r--src/wasm2asm.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h
index f7e852b3b..2ca6406b5 100644
--- a/src/wasm2asm.h
+++ b/src/wasm2asm.h
@@ -206,7 +206,11 @@ Ref Wasm2AsmBuilder::processFunction(Function* func) {
}
} else {
// whole thing is an expression, just do a return
- ret[3]->push_back(ValueBuilder::makeStatement(ValueBuilder::makeReturn(processFunctionBody(func->body, EXPRESSION_RESULT))));
+ if (func->result != none) {
+ ret[3]->push_back(ValueBuilder::makeStatement(ValueBuilder::makeReturn(processFunctionBody(func->body, EXPRESSION_RESULT))));
+ } else {
+ flattenAppend(ret, processFunctionBody(func->body, NO_RESULT));
+ }
}
// locals, including new temp locals
for (auto& local : func->locals) {