diff options
author | Alon Zakai <azakai@google.com> | 2023-03-06 17:15:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-06 17:15:22 -0800 |
commit | 61921b4af3f471508dff0d764b4ffbf0a4cba5fb (patch) | |
tree | 604f9f6e8adf1bb4908fc8897b27d2c9333ac4c7 /src | |
parent | 661fe5e72987e97d5f6db0d4cbefc73c1e166e36 (diff) | |
download | binaryen-61921b4af3f471508dff0d764b4ffbf0a4cba5fb.tar.gz binaryen-61921b4af3f471508dff0d764b4ffbf0a4cba5fb.tar.bz2 binaryen-61921b4af3f471508dff0d764b4ffbf0a4cba5fb.zip |
SignatureRefining: Skip types with supertypes for now (#5548)
We'd need to handle contravariance to optimize them.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/SignatureRefining.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/passes/SignatureRefining.cpp b/src/passes/SignatureRefining.cpp index 376c74442..de669dbb2 100644 --- a/src/passes/SignatureRefining.cpp +++ b/src/passes/SignatureRefining.cpp @@ -147,6 +147,12 @@ struct SignatureRefining : public Pass { for (auto& [type, info] : allInfo) { if (!subTypes.getStrictSubTypes(type).empty()) { info.canModify = false; + } else if (type.getSuperType()) { + // Also avoid modifying types with supertypes, as we do not handle + // contravariance here. That is, when we refine parameters we look for + // a more refined type, but the type must be *less* refined than the + // param type for the parent (or equal) TODO + info.canModify = false; } } |