Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ir/ExpressionAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ template<typename T> void visitImmediates(Expression* curr, T& visitor) {
visitor.visitInt(curr->op);
visitor.visitNonScopeName(curr->nameOperand);
}
void visitRefNull(RefNull* curr) {}
void visitRefNull(RefNull* curr) { visitor.visitType(curr->type); }
void visitRefIsNull(RefIsNull* curr) {}
void visitRefFunc(RefFunc* curr) { visitor.visitNonScopeName(curr->func); }
void visitTry(Try* curr) {}
Expand Down
9 changes: 6 additions & 3 deletions src/passes/Precompute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@ struct Precompute
curr->finalize();
return;
}
} else if (singleValue.isNull() &&
curr->value->template is<RefNull>()) {
return;
} else if (singleValue.isNull()) {
if (auto* n = curr->value->template dynCast<RefNull>()) {
n->finalize(singleValue.type);
curr->finalize();
return;
}
} else if (singleValue.type == Type::funcref) {
if (auto* r = curr->value->template dynCast<RefFunc>()) {
r->func = singleValue.getFunc();
Expand Down
5 changes: 3 additions & 2 deletions src/tools/execution-results.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct ExecutionResults {
// change (after duplicate function elimination or roundtripping)
// while the function contents are still the same
for (Literal& val : ret) {
if (val.type == Type::funcref) {
if (val.type == Type::funcref && !val.isNull()) {
val = Literal::makeFunc(Name("funcref"));
}
}
Expand Down Expand Up @@ -112,7 +112,8 @@ struct ExecutionResults {
}
std::cout << "[fuzz-exec] comparing " << name << '\n';
if (results[name] != other.results[name]) {
std::cout << "not identical!\n";
std::cout << "not identical! " << results[name]
<< " != " << other.results[name] << "\n";
return false;
}
}
Expand Down
6 changes: 5 additions & 1 deletion test/passes/optimize-instructions_all-features.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3713,7 +3713,11 @@
)
)
(func $if-arms-subtype (result anyref)
(ref.null extern)
(if (result anyref)
(i32.const 0)
(ref.null extern)
(ref.null func)
)
)
(func $optimize-boolean-context (param $x i32) (param $y i32)
(if
Expand Down