summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/passes/I64ToI32Lowering.cpp3
-rw-r--r--src/wasm/wasm-validator.cpp12
2 files changed, 9 insertions, 6 deletions
diff --git a/src/passes/I64ToI32Lowering.cpp b/src/passes/I64ToI32Lowering.cpp
index a0381ccd4..c06176e53 100644
--- a/src/passes/I64ToI32Lowering.cpp
+++ b/src/passes/I64ToI32Lowering.cpp
@@ -219,6 +219,9 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> {
// returns nullptr;
template<typename T>
T* visitGenericCall(T* curr, BuilderFunc<T> callBuilder) {
+ if (handleUnreachable(curr)) {
+ return nullptr;
+ }
bool fixed = false;
std::vector<Expression*> args;
for (auto* e : curr->operands) {
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 012cb0e36..ef6a29373 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -806,9 +806,6 @@ void FunctionValidator::visitCallIndirect(CallIndirect* curr) {
shouldBeTrue(!curr->isReturn || getModule()->features.hasTailCall(),
curr,
"return_call_indirect requires tail calls to be enabled");
- if (!info.validateGlobally) {
- return;
- }
shouldBeEqualOrFirstIsUnreachable(curr->target->type,
Type(Type::i32),
curr,
@@ -1960,6 +1957,9 @@ void FunctionValidator::visitRefFunc(RefFunc* curr) {
shouldBeTrue(getModule()->features.hasReferenceTypes(),
curr,
"ref.func requires reference-types to be enabled");
+ if (!info.validateGlobally) {
+ return;
+ }
auto* func = getModule()->getFunctionOrNull(curr->func);
shouldBeTrue(!!func, curr, "function argument of ref.func must exist");
}
@@ -2010,13 +2010,13 @@ void FunctionValidator::visitThrow(Throw* curr) {
shouldBeTrue(getModule()->features.hasExceptionHandling(),
curr,
"throw requires exception-handling to be enabled");
- if (!info.validateGlobally) {
- return;
- }
shouldBeEqual(curr->type,
Type(Type::unreachable),
curr,
"throw's type must be unreachable");
+ if (!info.validateGlobally) {
+ return;
+ }
auto* event = getModule()->getEventOrNull(curr->event);
if (!shouldBeTrue(!!event, curr, "throw's event must exist")) {
return;