diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/Inlining.cpp | 4 | ||||
-rw-r--r-- | src/wasm/wasm-validator.cpp | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/passes/Inlining.cpp b/src/passes/Inlining.cpp index 0c95dc4b4..25993c7ec 100644 --- a/src/passes/Inlining.cpp +++ b/src/passes/Inlining.cpp @@ -275,7 +275,9 @@ struct Updater : public PostWalker<Updater> { } curr->isReturn = false; curr->type = results; - if (curr->type.isConcrete()) { + // There might still be unreachable children causing this to be unreachable. + curr->finalize(); + if (results.isConcrete()) { replaceCurrent(builder->makeBreak(returnName, curr)); } else { replaceCurrent(builder->blockify(curr, builder->makeBreak(returnName))); diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 7a4bb6a97..ba8712d35 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -3074,8 +3074,11 @@ static void validateBinaryenIR(Module& wasm, ValidationInfo& info) { bool validControlFlowStructureChange = Properties::isControlFlowStructure(curr) && oldType.isConcrete() && newType == Type::unreachable; - if (!Type::isSubType(newType, oldType) && - !validControlFlowStructureChange) { + // It's ok in general for types to get refined as long as they don't + // become unreachable. + bool validRefinement = + Type::isSubType(newType, oldType) && newType != Type::unreachable; + if (!validRefinement && !validControlFlowStructureChange) { std::ostringstream ss; ss << "stale type found in " << scope << " on " << curr << "\n(marked as " << oldType << ", should be " << newType |