summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAshley Nelson <nashley@google.com>2024-02-22 19:23:53 -0800
committerGitHub <noreply@github.com>2024-02-22 19:23:53 -0800
commite3450ca714ac14a94f86fa7a8e8f84f414da15a5 (patch)
tree301ff345354e0a5ad3623d49a89bb8565882dbb3 /src
parentdabfd5b841619d6846f51ec574561e4d6c899f55 (diff)
downloadbinaryen-e3450ca714ac14a94f86fa7a8e8f84f414da15a5.tar.gz
binaryen-e3450ca714ac14a94f86fa7a8e8f84f414da15a5.tar.bz2
binaryen-e3450ca714ac14a94f86fa7a8e8f84f414da15a5.zip
[Parser] Condense redundant pop values (#6339)
A bit of clean-up, changes getBranchValue to use pop().
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-ir-builder.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp
index 6676d1cb4..1df441dad 100644
--- a/src/wasm/wasm-ir-builder.cpp
+++ b/src/wasm/wasm-ir-builder.cpp
@@ -416,19 +416,7 @@ Result<Expression*> IRBuilder::getBranchValue(Name labelName,
// Loops would receive their input type rather than their output type, if we
// supported that.
size_t numValues = (*scope)->getLoop() ? 0 : (*scope)->getResultType().size();
- std::vector<Expression*> values(numValues);
- for (size_t i = 0; i < numValues; ++i) {
- auto val = pop();
- CHECK_ERR(val);
- values[numValues - 1 - i] = *val;
- }
- if (numValues == 0) {
- return nullptr;
- } else if (numValues == 1) {
- return values[0];
- } else {
- return builder.makeTupleMake(values);
- }
+ return numValues == 0 ? nullptr : pop(numValues);
}
Result<> IRBuilder::visitBreak(Break* curr, std::optional<Index> label) {