summaryrefslogtreecommitdiff
path: root/src/passes/MergeSimilarFunctions.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-04-21 10:44:26 -0700
committerGitHub <noreply@github.com>2022-04-21 10:44:26 -0700
commit793eabd785716247949ce6a4e6ab31c008711d08 (patch)
treeb03eddec631dc3930bffb293882d34509d4e3419 /src/passes/MergeSimilarFunctions.cpp
parent65f09f262e00348462e3371fbc89c6c1d398fba1 (diff)
downloadbinaryen-793eabd785716247949ce6a4e6ab31c008711d08.tar.gz
binaryen-793eabd785716247949ce6a4e6ab31c008711d08.tar.bz2
binaryen-793eabd785716247949ce6a4e6ab31c008711d08.zip
[NominalFuzzing] MergeSimilarFunctions: handle nominal types properly (#4602)
This fixes two bugs: First, we need to compare the nominal types of function constants when looking for constants to "merge", not just their structure. Second, when creating the new function we must use the proper type of those constants, and not just another type.
Diffstat (limited to 'src/passes/MergeSimilarFunctions.cpp')
-rw-r--r--src/passes/MergeSimilarFunctions.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/passes/MergeSimilarFunctions.cpp b/src/passes/MergeSimilarFunctions.cpp
index d6e616c10..9edf327fc 100644
--- a/src/passes/MergeSimilarFunctions.cpp
+++ b/src/passes/MergeSimilarFunctions.cpp
@@ -118,7 +118,7 @@ struct ParamInfo {
return (*literals)[0].type;
} else if (auto callees = std::get_if<std::vector<Name>>(&values)) {
auto* callee = module->getFunction((*callees)[0]);
- return Type(callee->getSig(), NonNullable);
+ return Type(callee->type, NonNullable);
} else {
WASM_UNREACHABLE("unexpected const value type");
}
@@ -246,7 +246,7 @@ bool MergeSimilarFunctions::areInEquvalentClass(Function* lhs,
}
auto* lhsCallee = module->getFunction(lhsCast->target);
auto* rhsCallee = module->getFunction(rhsCast->target);
- if (lhsCallee->getSig() != rhsCallee->getSig()) {
+ if (lhsCallee->type != rhsCallee->type) {
return false;
}