diff options
author | Alon Zakai <azakai@google.com> | 2022-05-11 10:56:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-11 10:56:22 -0700 |
commit | bad3f9e8f058cfdaefb3d7d76a93e842665f8435 (patch) | |
tree | 840eb9c70df3b3475eb18f662d2375a9eda230f9 /src | |
parent | e209fcbc3fc66db775ec65d85dbd64a6069c1681 (diff) | |
download | binaryen-bad3f9e8f058cfdaefb3d7d76a93e842665f8435.tar.gz binaryen-bad3f9e8f058cfdaefb3d7d76a93e842665f8435.tar.bz2 binaryen-bad3f9e8f058cfdaefb3d7d76a93e842665f8435.zip |
[NominalFuzzing] Fix SignaturePruning on types with a super (#4657)
Do not prune parameters if there is a supertype that is a signature.
Without this we crash on an assertion in TypeBuilder when we try to
recreate the types (as we try to make a a subtype with fewer fields
than the super).
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/SignaturePruning.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/passes/SignaturePruning.cpp b/src/passes/SignaturePruning.cpp index 033333758..4f142eb97 100644 --- a/src/passes/SignaturePruning.cpp +++ b/src/passes/SignaturePruning.cpp @@ -143,6 +143,15 @@ struct SignaturePruning : public Pass { continue; } + // A type with a signature supertype cannot be optimized: we'd need to + // remove the field from the super as well, which atm we don't attempt to + // do. TODO + if (auto super = type.getSuperType()) { + if (super->isSignature()) { + continue; + } + } + // Apply constant indexes: find the parameters that are always sent a // constant value, and apply that value in the function. That then makes // the parameter unused (since the applied value makes us ignore the value |