summaryrefslogtreecommitdiff
path: root/src/passes/DeadCodeElimination.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/DeadCodeElimination.cpp')
-rw-r--r--src/passes/DeadCodeElimination.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/passes/DeadCodeElimination.cpp b/src/passes/DeadCodeElimination.cpp
index 996133ad5..f8acde7b0 100644
--- a/src/passes/DeadCodeElimination.cpp
+++ b/src/passes/DeadCodeElimination.cpp
@@ -185,6 +185,12 @@ struct DeadCodeElimination
tryy->body->type == Type::unreachable && allCatchesUnreachable) {
typeUpdater.changeType(tryy, Type::unreachable);
}
+ } else if (auto* tryTable = curr->dynCast<TryTable>()) {
+ // try_table can finish normally only if its body finishes normally.
+ if (tryTable->type != Type::unreachable &&
+ tryTable->body->type == Type::unreachable) {
+ typeUpdater.changeType(tryTable, Type::unreachable);
+ }
} else {
WASM_UNREACHABLE("unimplemented DCE control flow structure");
}