summaryrefslogtreecommitdiff
path: root/src/passes/SignatureRefining.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-03-03 14:36:34 -0800
committerGitHub <noreply@github.com>2023-03-03 14:36:34 -0800
commit069aec9946473f946e96dc82ca0ce40a8024c50f (patch)
treea1febaa4dfce870bfd39ee53820457143e9ab614 /src/passes/SignatureRefining.cpp
parentc891c01ca5813172775ae859126a0ec3857ad8b7 (diff)
downloadbinaryen-069aec9946473f946e96dc82ca0ce40a8024c50f.tar.gz
binaryen-069aec9946473f946e96dc82ca0ce40a8024c50f.tar.bz2
binaryen-069aec9946473f946e96dc82ca0ce40a8024c50f.zip
[Wasm GC] Skip types with subtypes in SignatureRefining (#5544)
For now just skip them, to avoid problems. In the future we should look into modifying their children, when possible. Fixes #5463
Diffstat (limited to 'src/passes/SignatureRefining.cpp')
-rw-r--r--src/passes/SignatureRefining.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/passes/SignatureRefining.cpp b/src/passes/SignatureRefining.cpp
index 15b89b2a7..376c74442 100644
--- a/src/passes/SignatureRefining.cpp
+++ b/src/passes/SignatureRefining.cpp
@@ -30,6 +30,7 @@
#include "ir/find_all.h"
#include "ir/lubs.h"
#include "ir/module-utils.h"
+#include "ir/subtypes.h"
#include "ir/type-updating.h"
#include "ir/utils.h"
#include "pass.h"
@@ -139,6 +140,16 @@ struct SignatureRefining : public Pass {
allInfo[exportedFunc->type].canModify = false;
}
+ // For now, do not optimize types that have subtypes. When we modify such a
+ // type we need to modify subtypes as well, similar to the analysis in
+ // TypeRefining, and perhaps we can unify this pass with that. TODO
+ SubTypes subTypes(*module);
+ for (auto& [type, info] : allInfo) {
+ if (!subTypes.getStrictSubTypes(type).empty()) {
+ info.canModify = false;
+ }
+ }
+
bool refinedResults = false;
// Compute optimal LUBs.