From 69d34c6bd9ad78f192cf4142b48a123eb61941ca Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Mon, 16 Mar 2020 10:30:48 -0700 Subject: Handle tuples in wasm-reduce (#2689) Also increases the usefulness of a couple wasm-builder methods that are useful here. --- src/tools/wasm-reduce.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/tools/wasm-reduce.cpp') 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()) { // 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()) { 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; -- cgit v1.2.3