diff options
author | Ashley Nelson <nashley@google.com> | 2024-02-22 19:23:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-22 19:23:53 -0800 |
commit | e3450ca714ac14a94f86fa7a8e8f84f414da15a5 (patch) | |
tree | 301ff345354e0a5ad3623d49a89bb8565882dbb3 /src | |
parent | dabfd5b841619d6846f51ec574561e4d6c899f55 (diff) | |
download | binaryen-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.cpp | 14 |
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) { |