Skip to content

Commit

Permalink
[Parser] Condense redundant pop values (WebAssembly#6339)
Browse files Browse the repository at this point in the history
A bit of clean-up, changes getBranchValue to use pop().
  • Loading branch information
ashleynh authored and radekdoulik committed Jul 12, 2024
1 parent 52495da commit 447ee82
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/wasm/wasm-ir-builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 447ee82

Please sign in to comment.