Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Parser] Condense redundant pop values #6339

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading