diff options
Diffstat (limited to 'src/ast')
-rw-r--r-- | src/ast/type-updating.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ast/type-updating.h b/src/ast/type-updating.h index 8063b3e59..c5f1d5344 100644 --- a/src/ast/type-updating.h +++ b/src/ast/type-updating.h @@ -266,6 +266,19 @@ struct TypeUpdater : public ExpressionStackWalker<TypeUpdater, UnifiedExpression } } } + + // efficiently update the type of an if, given the data we know. this + // can remove a concrete type and turn the if unreachable when it is + // unreachable + void maybeUpdateTypeToUnreachable(If* curr) { + if (!isConcreteWasmType(curr->type)) { + return; // nothing concrete to change to unreachable + } + curr->finalize(); + if (curr->type == unreachable) { + propagateTypesUp(curr); + } + } }; } // namespace wasm |