summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/passes/MergeBlocks.cpp2
-rw-r--r--src/wasm/wasm.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/passes/MergeBlocks.cpp b/src/passes/MergeBlocks.cpp
index 455e54971..d32948bee 100644
--- a/src/passes/MergeBlocks.cpp
+++ b/src/passes/MergeBlocks.cpp
@@ -213,7 +213,7 @@ static void optimizeBlock(Block* curr, Module* module) {
break;
}
}
- if (changed) curr->finalize();
+ if (changed) curr->finalize(curr->type);
}
void BreakValueDropper::visitBlock(Block* curr) {
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 4f5f46f0a..635d14354 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -109,18 +109,20 @@ struct TypeSeeker : public PostWalker<TypeSeeker> {
Name targetName;
std::vector<WasmType> types;
+
TypeSeeker(Expression* target, Name targetName) : target(target), targetName(targetName) {
Expression* temp = target;
walk(temp);
}
void visitBreak(Break* curr) {
- if (curr->name == targetName) {
+ if (curr->name == targetName && BranchUtils::isBranchTaken(curr)) {
types.push_back(curr->value ? curr->value->type : none);
}
}
void visitSwitch(Switch* curr) {
+ if (!BranchUtils::isBranchTaken(curr)) return;
for (auto name : curr->targets) {
if (name == targetName) types.push_back(curr->value ? curr->value->type : none);
}