diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2020-03-16 10:30:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 10:30:48 -0700 |
commit | 69d34c6bd9ad78f192cf4142b48a123eb61941ca (patch) | |
tree | 99d9696a0edf6e7d5337b51e48f7ac43ca092e3b /src/tools/wasm-reduce.cpp | |
parent | a3bbe87a97fe6cafa665d3e1a03c28f31b82eff5 (diff) | |
download | binaryen-69d34c6bd9ad78f192cf4142b48a123eb61941ca.tar.gz binaryen-69d34c6bd9ad78f192cf4142b48a123eb61941ca.tar.bz2 binaryen-69d34c6bd9ad78f192cf4142b48a123eb61941ca.zip |
Handle tuples in wasm-reduce (#2689)
Also increases the usefulness of a couple wasm-builder methods that
are useful here.
Diffstat (limited to 'src/tools/wasm-reduce.cpp')
-rw-r--r-- | src/tools/wasm-reduce.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index ac00ce045..6ba5c5b83 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -566,14 +566,14 @@ struct Reducer } } } - // If that didn't work, try to replace with a child + a unary conversion - if (curr->type.isConcrete() && - !curr->is<Unary>()) { // but not if it's already unary + // If that didn't work, try to replace with a child + a unary conversion, + // but not if it's already unary + if (curr->type.isSingle() && !curr->is<Unary>()) { for (auto* child : ChildIterator(curr)) { if (child->type == curr->type) { continue; // already tried } - if (!child->type.isConcrete()) { + if (!child->type.isSingle()) { continue; // no conversion } Expression* fixed = nullptr; @@ -1013,6 +1013,11 @@ struct Reducer RefNull* n = builder->makeRefNull(); return tryToReplaceCurrent(n); } + if (curr->type.isMulti()) { + Expression* n = + builder->makeConstExpression(Literal::makeZero(curr->type)); + return tryToReplaceCurrent(n); + } Const* c = builder->makeConst(Literal(int32_t(0))); if (tryToReplaceCurrent(c)) { return true; |