summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/passes/DeadCodeElimination.cpp33
-rw-r--r--src/passes/Print.cpp2
-rw-r--r--src/wasm-interpreter.h4
-rw-r--r--src/wasm-s-parser.h14
-rw-r--r--src/wasm-traversal.h6
-rw-r--r--test/emcc_O2_hello_world.fromasm46
-rw-r--r--test/emcc_O2_hello_world.fromasm.imprecise46
-rw-r--r--test/emcc_O2_hello_world.fromasm.imprecise.no-opts46
-rw-r--r--test/emcc_O2_hello_world.fromasm.no-opts46
-rw-r--r--test/emcc_hello_world.fromasm46
-rw-r--r--test/emcc_hello_world.fromasm.imprecise46
-rw-r--r--test/emcc_hello_world.fromasm.imprecise.no-opts40
-rw-r--r--test/emcc_hello_world.fromasm.no-opts40
-rw-r--r--test/example/c-api-kitchen-sink.txt4
-rw-r--r--test/example/c-api-kitchen-sink.txt.txt2
-rw-r--r--test/memorygrowth.fromasm46
-rw-r--r--test/memorygrowth.fromasm.imprecise46
-rw-r--r--test/memorygrowth.fromasm.imprecise.no-opts46
-rw-r--r--test/memorygrowth.fromasm.no-opts46
-rw-r--r--test/passes/dce.wast3
-rw-r--r--test/passes/remove-unused-names_merge-blocks.txt16
-rw-r--r--test/unit.fromasm10
-rw-r--r--test/unit.fromasm.imprecise10
-rw-r--r--test/unit.fromasm.imprecise.no-opts6
-rw-r--r--test/unit.fromasm.no-opts6
-rw-r--r--test/unit.wast4
-rw-r--r--test/unit.wast.fromBinary4
27 files changed, 333 insertions, 331 deletions
diff --git a/src/passes/DeadCodeElimination.cpp b/src/passes/DeadCodeElimination.cpp
index aba442e71..866b3cb73 100644
--- a/src/passes/DeadCodeElimination.cpp
+++ b/src/passes/DeadCodeElimination.cpp
@@ -234,45 +234,46 @@ struct DeadCodeElimination : public WalkerPass<PostWalker<DeadCodeElimination, V
}
template<typename T>
- void handleCall(T* curr, Expression* initial) {
+ Expression* handleCall(T* curr) {
for (Index i = 0; i < curr->operands.size(); i++) {
if (isDead(curr->operands[i])) {
- if (i > 0 || initial != nullptr) {
+ if (i > 0) {
auto* block = getModule()->allocator.alloc<Block>();
- Index newSize = i + 1 + (initial ? 1 : 0);
+ Index newSize = i + 1;
block->list.resize(newSize);
Index j = 0;
- if (initial) {
- block->list[j] = drop(initial);
- j++;
- }
for (; j < newSize; j++) {
- block->list[j] = drop(curr->operands[j - (initial ? 1 : 0)]);
+ block->list[j] = drop(curr->operands[j]);
}
block->finalize();
- replaceCurrent(block);
+ return replaceCurrent(block);
} else {
- replaceCurrent(curr->operands[i]);
+ return replaceCurrent(curr->operands[i]);
}
- return;
}
}
+ return curr;
}
void visitCall(Call* curr) {
- handleCall(curr, nullptr);
+ handleCall(curr);
}
void visitCallImport(CallImport* curr) {
- handleCall(curr, nullptr);
+ handleCall(curr);
}
void visitCallIndirect(CallIndirect* curr) {
+ if (handleCall(curr) != curr) return;
if (isDead(curr->target)) {
- replaceCurrent(curr->target);
- return;
+ auto* block = getModule()->allocator.alloc<Block>();
+ for (auto* operand : curr->operands) {
+ block->list.push_back(drop(operand));
+ }
+ block->list.push_back(curr->target);
+ block->finalize();
+ replaceCurrent(block);
}
- handleCall(curr, curr->target);
}
void visitSetLocal(SetLocal* curr) {
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 4f6baa9da..e54468c41 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -230,10 +230,10 @@ struct PrintSExpression : public Visitor<PrintSExpression> {
void visitCallIndirect(CallIndirect *curr) {
printOpening(o, "call_indirect ") << curr->fullType;
incIndent();
- printFullLine(curr->target);
for (auto operand : curr->operands) {
printFullLine(operand);
}
+ printFullLine(curr->target);
decIndent();
}
void visitGetLocal(GetLocal *curr) {
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 9d1b5e522..77cbd8aab 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -676,11 +676,11 @@ public:
}
Flow visitCallIndirect(CallIndirect *curr) {
NOTE_ENTER("CallIndirect");
- Flow target = visit(curr->target);
- if (target.breaking()) return target;
LiteralList arguments;
Flow flow = generateArguments(curr->operands, arguments);
if (flow.breaking()) return flow;
+ Flow target = visit(curr->target);
+ if (target.breaking()) return target;
Index index = target.value.geti32();
return instance.externalInterface->callTable(index, curr->fullType, arguments, instance);
}
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 685f26d82..49fd52ef0 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -895,7 +895,7 @@ private:
if (op == HostOp::HasFeature) {
ret->nameOperand = s[1]->str();
} else {
- parseCallOperands(s, 1, ret);
+ parseCallOperands(s, 1, s.size(), ret);
}
ret->finalize();
return ret;
@@ -1196,7 +1196,7 @@ private:
auto ret = allocator.alloc<Call>();
ret->target = s[1]->str();
ret->type = functionTypes[ret->target];
- parseCallOperands(s, 2, ret);
+ parseCallOperands(s, 2, s.size(), ret);
return ret;
}
@@ -1205,7 +1205,7 @@ private:
ret->target = s[1]->str();
Import* import = wasm.getImport(ret->target);
ret->type = import->type->result;
- parseCallOperands(s, 2, ret);
+ parseCallOperands(s, 2, s.size(), ret);
return ret;
}
@@ -1216,14 +1216,14 @@ private:
if (!fullType) throw ParseException("invalid call_indirect type", s.line, s.col);
ret->fullType = fullType->name;
ret->type = fullType->result;
- ret->target = parseExpression(s[2]);
- parseCallOperands(s, 3, ret);
+ parseCallOperands(s, 2, s.size() - 1, ret);
+ ret->target = parseExpression(s[s.size() - 1]);
return ret;
}
template<class T>
- void parseCallOperands(Element& s, size_t i, T* call) {
- while (i < s.size()) {
+ void parseCallOperands(Element& s, Index i, Index j, T* call) {
+ while (i < j) {
call->operands.push_back(parseExpression(s[i]));
i++;
}
diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h
index d6484abdb..f9d3d8413 100644
--- a/src/wasm-traversal.h
+++ b/src/wasm-traversal.h
@@ -156,8 +156,8 @@ struct Walker : public VisitorType {
// Note that the visit*() for the result node is not called for you (i.e.,
// just one visit*() method is called by the traversal; if you replace a node,
// and you want to process the output, you must do that explicitly).
- void replaceCurrent(Expression *expression) {
- replace = expression;
+ Expression* replaceCurrent(Expression *expression) {
+ return replace = expression;
}
// Get the current module
@@ -358,10 +358,10 @@ struct PostWalker : public Walker<SubType, VisitorType> {
case Expression::Id::CallIndirectId: {
self->pushTask(SubType::doVisitCallIndirect, currp);
auto& list = curr->cast<CallIndirect>()->operands;
+ self->pushTask(SubType::scan, &curr->cast<CallIndirect>()->target);
for (int i = int(list.size()) - 1; i >= 0; i--) {
self->pushTask(SubType::scan, &list[i]);
}
- self->pushTask(SubType::scan, &curr->cast<CallIndirect>()->target);
break;
}
case Expression::Id::GetLocalId: {
diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm
index 04e0d76c6..5f36a6209 100644
--- a/test/emcc_O2_hello_world.fromasm
+++ b/test/emcc_O2_hello_world.fromasm
@@ -8257,6 +8257,9 @@
(block
(set_local $4
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $1)
(i32.add
(i32.and
(i32.load offset=36
@@ -8266,9 +8269,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $1)
)
)
(br $label$break$L5)
@@ -8334,6 +8334,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $4)
(i32.add
(i32.and
(i32.load offset=36
@@ -8343,9 +8346,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $4)
)
(get_local $4)
)
@@ -8831,6 +8831,9 @@
(if
(i32.eq
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (get_local $6)
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=36
@@ -8840,9 +8843,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (get_local $6)
- (i32.const 1)
)
(i32.const 1)
)
@@ -8891,6 +8891,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load offset=36
@@ -8900,9 +8903,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.const 0)
- (i32.const 0)
)
)
(i32.eq
@@ -8940,6 +8940,12 @@
)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.sub
+ (get_local $4)
+ (get_local $6)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=40
@@ -8949,12 +8955,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.sub
- (get_local $4)
- (get_local $6)
- )
- (i32.const 1)
)
)
(i32.store offset=16
@@ -9815,6 +9815,9 @@
)
(func $dynCall_iiii (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(call_indirect $FUNCSIG$iiii
+ (get_local $1)
+ (get_local $2)
+ (get_local $3)
(i32.add
(i32.and
(get_local $0)
@@ -9822,9 +9825,6 @@
)
(i32.const 2)
)
- (get_local $1)
- (get_local $2)
- (get_local $3)
)
)
(func $stackAlloc (param $0 i32) (result i32)
@@ -9902,6 +9902,7 @@
)
(func $dynCall_ii (param $0 i32) (param $1 i32) (result i32)
(call_indirect $FUNCSIG$ii
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -9909,7 +9910,6 @@
)
(i32.const 0)
)
- (get_local $1)
)
)
(func $_cleanup_418 (param $0 i32)
@@ -9936,6 +9936,7 @@
)
(func $dynCall_vi (param $0 i32) (param $1 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -9943,7 +9944,6 @@
)
(i32.const 10)
)
- (get_local $1)
)
)
(func $b1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
diff --git a/test/emcc_O2_hello_world.fromasm.imprecise b/test/emcc_O2_hello_world.fromasm.imprecise
index a87591d78..a79d63e05 100644
--- a/test/emcc_O2_hello_world.fromasm.imprecise
+++ b/test/emcc_O2_hello_world.fromasm.imprecise
@@ -8256,6 +8256,9 @@
(block
(set_local $4
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $1)
(i32.add
(i32.and
(i32.load offset=36
@@ -8265,9 +8268,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $1)
)
)
(br $label$break$L5)
@@ -8333,6 +8333,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $4)
(i32.add
(i32.and
(i32.load offset=36
@@ -8342,9 +8345,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $4)
)
(get_local $4)
)
@@ -8830,6 +8830,9 @@
(if
(i32.eq
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (get_local $6)
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=36
@@ -8839,9 +8842,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (get_local $6)
- (i32.const 1)
)
(i32.const 1)
)
@@ -8890,6 +8890,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load offset=36
@@ -8899,9 +8902,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.const 0)
- (i32.const 0)
)
)
(i32.eq
@@ -8939,6 +8939,12 @@
)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.sub
+ (get_local $4)
+ (get_local $6)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=40
@@ -8948,12 +8954,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.sub
- (get_local $4)
- (get_local $6)
- )
- (i32.const 1)
)
)
(i32.store offset=16
@@ -9814,6 +9814,9 @@
)
(func $dynCall_iiii (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(call_indirect $FUNCSIG$iiii
+ (get_local $1)
+ (get_local $2)
+ (get_local $3)
(i32.add
(i32.and
(get_local $0)
@@ -9821,9 +9824,6 @@
)
(i32.const 2)
)
- (get_local $1)
- (get_local $2)
- (get_local $3)
)
)
(func $stackAlloc (param $0 i32) (result i32)
@@ -9901,6 +9901,7 @@
)
(func $dynCall_ii (param $0 i32) (param $1 i32) (result i32)
(call_indirect $FUNCSIG$ii
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -9908,7 +9909,6 @@
)
(i32.const 0)
)
- (get_local $1)
)
)
(func $_cleanup_418 (param $0 i32)
@@ -9935,6 +9935,7 @@
)
(func $dynCall_vi (param $0 i32) (param $1 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -9942,7 +9943,6 @@
)
(i32.const 10)
)
- (get_local $1)
)
)
(func $b1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
diff --git a/test/emcc_O2_hello_world.fromasm.imprecise.no-opts b/test/emcc_O2_hello_world.fromasm.imprecise.no-opts
index df7888820..5c70bf1c4 100644
--- a/test/emcc_O2_hello_world.fromasm.imprecise.no-opts
+++ b/test/emcc_O2_hello_world.fromasm.imprecise.no-opts
@@ -9726,6 +9726,9 @@
(block
(set_local $i8
(call_indirect $FUNCSIG$iiii
+ (get_local $i3)
+ (get_local $i1)
+ (get_local $i2)
(i32.add
(i32.and
(i32.load
@@ -9738,9 +9741,6 @@
)
(i32.const 2)
)
- (get_local $i3)
- (get_local $i1)
- (get_local $i2)
)
)
(br $label$break$L5)
@@ -9813,6 +9813,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $i3)
+ (get_local $i1)
+ (get_local $i15)
(i32.add
(i32.and
(i32.load
@@ -9825,9 +9828,6 @@
)
(i32.const 2)
)
- (get_local $i3)
- (get_local $i1)
- (get_local $i15)
)
(get_local $i15)
)
@@ -10433,6 +10433,9 @@
(if
(i32.eq
(call_indirect $FUNCSIG$iiii
+ (get_local $i1)
+ (get_local $i4)
+ (i32.const 1)
(i32.add
(i32.and
(i32.load
@@ -10445,9 +10448,6 @@
)
(i32.const 2)
)
- (get_local $i1)
- (get_local $i4)
- (i32.const 1)
)
(i32.const 1)
)
@@ -10504,6 +10504,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $i1)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load
@@ -10516,9 +10519,6 @@
)
(i32.const 2)
)
- (get_local $i1)
- (i32.const 0)
- (i32.const 0)
)
)
(i32.eq
@@ -10562,6 +10562,12 @@
(get_local $i8)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $i1)
+ (i32.sub
+ (get_local $i6)
+ (get_local $i8)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load
@@ -10574,12 +10580,6 @@
)
(i32.const 2)
)
- (get_local $i1)
- (i32.sub
- (get_local $i6)
- (get_local $i8)
- )
- (i32.const 1)
)
)
(i32.store
@@ -11680,6 +11680,9 @@
(func $dynCall_iiii (param $i1 i32) (param $i2 i32) (param $i3 i32) (param $i4 i32) (result i32)
(return
(call_indirect $FUNCSIG$iiii
+ (get_local $i2)
+ (get_local $i3)
+ (get_local $i4)
(i32.add
(i32.and
(get_local $i1)
@@ -11687,9 +11690,6 @@
)
(i32.const 2)
)
- (get_local $i2)
- (get_local $i3)
- (get_local $i4)
)
)
)
@@ -11786,6 +11786,7 @@
(func $dynCall_ii (param $i1 i32) (param $i2 i32) (result i32)
(return
(call_indirect $FUNCSIG$ii
+ (get_local $i2)
(i32.add
(i32.and
(get_local $i1)
@@ -11793,7 +11794,6 @@
)
(i32.const 0)
)
- (get_local $i2)
)
)
)
@@ -11825,6 +11825,7 @@
)
(func $dynCall_vi (param $i1 i32) (param $i2 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $i2)
(i32.add
(i32.and
(get_local $i1)
@@ -11832,7 +11833,6 @@
)
(i32.const 10)
)
- (get_local $i2)
)
)
(func $b1 (param $i1 i32) (param $i2 i32) (param $i3 i32) (result i32)
diff --git a/test/emcc_O2_hello_world.fromasm.no-opts b/test/emcc_O2_hello_world.fromasm.no-opts
index 2c1f718ff..69db3001b 100644
--- a/test/emcc_O2_hello_world.fromasm.no-opts
+++ b/test/emcc_O2_hello_world.fromasm.no-opts
@@ -9727,6 +9727,9 @@
(block
(set_local $i8
(call_indirect $FUNCSIG$iiii
+ (get_local $i3)
+ (get_local $i1)
+ (get_local $i2)
(i32.add
(i32.and
(i32.load
@@ -9739,9 +9742,6 @@
)
(i32.const 2)
)
- (get_local $i3)
- (get_local $i1)
- (get_local $i2)
)
)
(br $label$break$L5)
@@ -9814,6 +9814,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $i3)
+ (get_local $i1)
+ (get_local $i15)
(i32.add
(i32.and
(i32.load
@@ -9826,9 +9829,6 @@
)
(i32.const 2)
)
- (get_local $i3)
- (get_local $i1)
- (get_local $i15)
)
(get_local $i15)
)
@@ -10434,6 +10434,9 @@
(if
(i32.eq
(call_indirect $FUNCSIG$iiii
+ (get_local $i1)
+ (get_local $i4)
+ (i32.const 1)
(i32.add
(i32.and
(i32.load
@@ -10446,9 +10449,6 @@
)
(i32.const 2)
)
- (get_local $i1)
- (get_local $i4)
- (i32.const 1)
)
(i32.const 1)
)
@@ -10505,6 +10505,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $i1)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load
@@ -10517,9 +10520,6 @@
)
(i32.const 2)
)
- (get_local $i1)
- (i32.const 0)
- (i32.const 0)
)
)
(i32.eq
@@ -10563,6 +10563,12 @@
(get_local $i8)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $i1)
+ (i32.sub
+ (get_local $i6)
+ (get_local $i8)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load
@@ -10575,12 +10581,6 @@
)
(i32.const 2)
)
- (get_local $i1)
- (i32.sub
- (get_local $i6)
- (get_local $i8)
- )
- (i32.const 1)
)
)
(i32.store
@@ -11681,6 +11681,9 @@
(func $dynCall_iiii (param $i1 i32) (param $i2 i32) (param $i3 i32) (param $i4 i32) (result i32)
(return
(call_indirect $FUNCSIG$iiii
+ (get_local $i2)
+ (get_local $i3)
+ (get_local $i4)
(i32.add
(i32.and
(get_local $i1)
@@ -11688,9 +11691,6 @@
)
(i32.const 2)
)
- (get_local $i2)
- (get_local $i3)
- (get_local $i4)
)
)
)
@@ -11787,6 +11787,7 @@
(func $dynCall_ii (param $i1 i32) (param $i2 i32) (result i32)
(return
(call_indirect $FUNCSIG$ii
+ (get_local $i2)
(i32.add
(i32.and
(get_local $i1)
@@ -11794,7 +11795,6 @@
)
(i32.const 0)
)
- (get_local $i2)
)
)
)
@@ -11826,6 +11826,7 @@
)
(func $dynCall_vi (param $i1 i32) (param $i2 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $i2)
(i32.add
(i32.and
(get_local $i1)
@@ -11833,7 +11834,6 @@
)
(i32.const 10)
)
- (get_local $i2)
)
)
(func $b1 (param $i1 i32) (param $i2 i32) (param $i3 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm
index edcebd3ed..3187c00a7 100644
--- a/test/emcc_hello_world.fromasm
+++ b/test/emcc_hello_world.fromasm
@@ -1635,6 +1635,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load offset=36
@@ -1644,9 +1647,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.const 0)
- (i32.const 0)
)
)
(set_local $1
@@ -1813,6 +1813,9 @@
(block
(set_local $4
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $1)
(i32.add
(i32.and
(i32.load offset=36
@@ -1822,9 +1825,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $1)
)
)
(br $label$break$L5)
@@ -1896,6 +1896,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $3)
(i32.add
(i32.and
(i32.load offset=36
@@ -1905,9 +1908,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $3)
)
(get_local $3)
)
@@ -2748,6 +2748,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load offset=36
@@ -2757,9 +2760,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.const 0)
- (i32.const 0)
)
)
(if
@@ -2811,6 +2811,12 @@
)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.sub
+ (get_local $1)
+ (get_local $2)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=40
@@ -2820,12 +2826,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.sub
- (get_local $1)
- (get_local $2)
- )
- (i32.const 1)
)
)
(i32.store offset=16
@@ -19397,6 +19397,7 @@
)
(func $dynCall_ii (param $0 i32) (param $1 i32) (result i32)
(call_indirect $FUNCSIG$ii
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -19404,11 +19405,13 @@
)
(i32.const 0)
)
- (get_local $1)
)
)
(func $dynCall_iiii (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(call_indirect $FUNCSIG$iiii
+ (get_local $1)
+ (get_local $2)
+ (get_local $3)
(i32.add
(i32.and
(get_local $0)
@@ -19416,13 +19419,11 @@
)
(i32.const 2)
)
- (get_local $1)
- (get_local $2)
- (get_local $3)
)
)
(func $dynCall_vi (param $0 i32) (param $1 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -19430,7 +19431,6 @@
)
(i32.const 10)
)
- (get_local $1)
)
)
(func $b0 (param $0 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise
index f0e3e992d..22f7c4018 100644
--- a/test/emcc_hello_world.fromasm.imprecise
+++ b/test/emcc_hello_world.fromasm.imprecise
@@ -1629,6 +1629,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load offset=36
@@ -1638,9 +1641,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.const 0)
- (i32.const 0)
)
)
(set_local $1
@@ -1807,6 +1807,9 @@
(block
(set_local $4
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $1)
(i32.add
(i32.and
(i32.load offset=36
@@ -1816,9 +1819,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $1)
)
)
(br $label$break$L5)
@@ -1890,6 +1890,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $3)
(i32.add
(i32.and
(i32.load offset=36
@@ -1899,9 +1902,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $3)
)
(get_local $3)
)
@@ -2742,6 +2742,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load offset=36
@@ -2751,9 +2754,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.const 0)
- (i32.const 0)
)
)
(if
@@ -2805,6 +2805,12 @@
)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.sub
+ (get_local $1)
+ (get_local $2)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=40
@@ -2814,12 +2820,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.sub
- (get_local $1)
- (get_local $2)
- )
- (i32.const 1)
)
)
(i32.store offset=16
@@ -19382,6 +19382,7 @@
)
(func $dynCall_ii (param $0 i32) (param $1 i32) (result i32)
(call_indirect $FUNCSIG$ii
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -19389,11 +19390,13 @@
)
(i32.const 0)
)
- (get_local $1)
)
)
(func $dynCall_iiii (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(call_indirect $FUNCSIG$iiii
+ (get_local $1)
+ (get_local $2)
+ (get_local $3)
(i32.add
(i32.and
(get_local $0)
@@ -19401,13 +19404,11 @@
)
(i32.const 2)
)
- (get_local $1)
- (get_local $2)
- (get_local $3)
)
)
(func $dynCall_vi (param $0 i32) (param $1 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -19415,7 +19416,6 @@
)
(i32.const 10)
)
- (get_local $1)
)
)
(func $b0 (param $0 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm.imprecise.no-opts b/test/emcc_hello_world.fromasm.imprecise.no-opts
index dcb3c1f15..70da0bd37 100644
--- a/test/emcc_hello_world.fromasm.imprecise.no-opts
+++ b/test/emcc_hello_world.fromasm.imprecise.no-opts
@@ -2646,6 +2646,9 @@
)
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(get_local $$5)
@@ -2653,9 +2656,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (i32.const 0)
- (i32.const 0)
)
)
(set_local $$6
@@ -2939,6 +2939,9 @@
)
(set_local $$call4
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (get_local $$s)
+ (get_local $$l)
(i32.add
(i32.and
(get_local $$5)
@@ -2946,9 +2949,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (get_local $$s)
- (get_local $$l)
)
)
(set_local $$retval$0
@@ -3068,6 +3068,9 @@
)
(set_local $$call16
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (get_local $$s)
+ (get_local $$i$0$lcssa36)
(i32.add
(i32.and
(get_local $$8)
@@ -3075,9 +3078,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (get_local $$s)
- (get_local $$i$0$lcssa36)
)
)
(set_local $$cmp17
@@ -4553,6 +4553,9 @@
)
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(get_local $$2)
@@ -4560,9 +4563,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (i32.const 0)
- (i32.const 0)
)
)
(set_local $$3
@@ -4651,6 +4651,9 @@
)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (get_local $$sub$ptr$sub)
+ (i32.const 1)
(i32.add
(i32.and
(get_local $$6)
@@ -4658,9 +4661,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (get_local $$sub$ptr$sub)
- (i32.const 1)
)
)
)
@@ -32718,6 +32718,7 @@
(func $dynCall_ii (param $index i32) (param $a1 i32) (result i32)
(return
(call_indirect $FUNCSIG$ii
+ (get_local $a1)
(i32.add
(i32.and
(get_local $index)
@@ -32725,13 +32726,15 @@
)
(i32.const 0)
)
- (get_local $a1)
)
)
)
(func $dynCall_iiii (param $index i32) (param $a1 i32) (param $a2 i32) (param $a3 i32) (result i32)
(return
(call_indirect $FUNCSIG$iiii
+ (get_local $a1)
+ (get_local $a2)
+ (get_local $a3)
(i32.add
(i32.and
(get_local $index)
@@ -32739,14 +32742,12 @@
)
(i32.const 2)
)
- (get_local $a1)
- (get_local $a2)
- (get_local $a3)
)
)
)
(func $dynCall_vi (param $index i32) (param $a1 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $a1)
(i32.add
(i32.and
(get_local $index)
@@ -32754,7 +32755,6 @@
)
(i32.const 10)
)
- (get_local $a1)
)
)
(func $b0 (param $p0 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm.no-opts b/test/emcc_hello_world.fromasm.no-opts
index fcf34e3ec..414971404 100644
--- a/test/emcc_hello_world.fromasm.no-opts
+++ b/test/emcc_hello_world.fromasm.no-opts
@@ -2652,6 +2652,9 @@
)
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(get_local $$5)
@@ -2659,9 +2662,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (i32.const 0)
- (i32.const 0)
)
)
(set_local $$6
@@ -2945,6 +2945,9 @@
)
(set_local $$call4
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (get_local $$s)
+ (get_local $$l)
(i32.add
(i32.and
(get_local $$5)
@@ -2952,9 +2955,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (get_local $$s)
- (get_local $$l)
)
)
(set_local $$retval$0
@@ -3074,6 +3074,9 @@
)
(set_local $$call16
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (get_local $$s)
+ (get_local $$i$0$lcssa36)
(i32.add
(i32.and
(get_local $$8)
@@ -3081,9 +3084,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (get_local $$s)
- (get_local $$i$0$lcssa36)
)
)
(set_local $$cmp17
@@ -4559,6 +4559,9 @@
)
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(get_local $$2)
@@ -4566,9 +4569,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (i32.const 0)
- (i32.const 0)
)
)
(set_local $$3
@@ -4657,6 +4657,9 @@
)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $$f)
+ (get_local $$sub$ptr$sub)
+ (i32.const 1)
(i32.add
(i32.and
(get_local $$6)
@@ -4664,9 +4667,6 @@
)
(i32.const 2)
)
- (get_local $$f)
- (get_local $$sub$ptr$sub)
- (i32.const 1)
)
)
)
@@ -32724,6 +32724,7 @@
(func $dynCall_ii (param $index i32) (param $a1 i32) (result i32)
(return
(call_indirect $FUNCSIG$ii
+ (get_local $a1)
(i32.add
(i32.and
(get_local $index)
@@ -32731,13 +32732,15 @@
)
(i32.const 0)
)
- (get_local $a1)
)
)
)
(func $dynCall_iiii (param $index i32) (param $a1 i32) (param $a2 i32) (param $a3 i32) (result i32)
(return
(call_indirect $FUNCSIG$iiii
+ (get_local $a1)
+ (get_local $a2)
+ (get_local $a3)
(i32.add
(i32.and
(get_local $index)
@@ -32745,14 +32748,12 @@
)
(i32.const 2)
)
- (get_local $a1)
- (get_local $a2)
- (get_local $a3)
)
)
)
(func $dynCall_vi (param $index i32) (param $a1 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $a1)
(i32.add
(i32.and
(get_local $index)
@@ -32760,7 +32761,6 @@
)
(i32.const 10)
)
- (get_local $a1)
)
)
(func $b0 (param $p0 i32) (result i32)
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index c848f0f7c..37e7b6040 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -466,11 +466,11 @@ BinaryenFloat64: 4
(drop
(i32.eqz
(call_indirect $iiIfF
- (i32.const 2449)
(i32.const 13)
(i64.const 37)
(f32.const 1.2999999523162842)
(f64.const 3.7)
+ (i32.const 2449)
)
)
)
@@ -2060,11 +2060,11 @@ int main() {
(drop
(i32.eqz
(call_indirect $iiIfF
- (i32.const 2449)
(i32.const 13)
(i64.const 37)
(f32.const 1.2999999523162842)
(f64.const 3.7)
+ (i32.const 2449)
)
)
)
diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt
index 52da01f9d..29b242c2f 100644
--- a/test/example/c-api-kitchen-sink.txt.txt
+++ b/test/example/c-api-kitchen-sink.txt.txt
@@ -461,11 +461,11 @@
(drop
(i32.eqz
(call_indirect $iiIfF
- (i32.const 2449)
(i32.const 13)
(i64.const 37)
(f32.const 1.2999999523162842)
(f64.const 3.7)
+ (i32.const 2449)
)
)
)
diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm
index d39786018..4b5409dcb 100644
--- a/test/memorygrowth.fromasm
+++ b/test/memorygrowth.fromasm
@@ -8342,6 +8342,9 @@
(block
(set_local $4
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $1)
(i32.add
(i32.and
(i32.load offset=36
@@ -8351,9 +8354,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $1)
)
)
(br $label$break$a)
@@ -8419,6 +8419,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $4)
(i32.add
(i32.and
(i32.load offset=36
@@ -8428,9 +8431,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $4)
)
(get_local $4)
)
@@ -8911,6 +8911,9 @@
(if
(i32.eq
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (get_local $6)
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=36
@@ -8920,9 +8923,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (get_local $6)
- (i32.const 1)
)
(i32.const 1)
)
@@ -8970,6 +8970,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load offset=36
@@ -8979,9 +8982,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.const 0)
- (i32.const 0)
)
)
(if
@@ -9030,6 +9030,12 @@
)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.sub
+ (get_local $2)
+ (get_local $6)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=40
@@ -9039,12 +9045,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.sub
- (get_local $2)
- (get_local $6)
- )
- (i32.const 1)
)
)
(i32.store offset=16
@@ -9912,6 +9912,9 @@
)
(func $lb (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(call_indirect $FUNCSIG$iiii
+ (get_local $1)
+ (get_local $2)
+ (get_local $3)
(i32.add
(i32.and
(get_local $0)
@@ -9919,9 +9922,6 @@
)
(i32.const 2)
)
- (get_local $1)
- (get_local $2)
- (get_local $3)
)
)
(func $Ea (param $0 i32) (result i32)
@@ -9994,6 +9994,7 @@
)
(func $kb (param $0 i32) (param $1 i32) (result i32)
(call_indirect $FUNCSIG$ii
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -10001,7 +10002,6 @@
)
(i32.const 0)
)
- (get_local $1)
)
)
(func $Sa (param $0 i32)
@@ -10018,6 +10018,7 @@
)
(func $mb (param $0 i32) (param $1 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -10025,7 +10026,6 @@
)
(i32.const 6)
)
- (get_local $1)
)
)
(func $Ha (param $0 i32) (param $1 i32)
diff --git a/test/memorygrowth.fromasm.imprecise b/test/memorygrowth.fromasm.imprecise
index b876bc869..65be97cf1 100644
--- a/test/memorygrowth.fromasm.imprecise
+++ b/test/memorygrowth.fromasm.imprecise
@@ -8341,6 +8341,9 @@
(block
(set_local $4
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $1)
(i32.add
(i32.and
(i32.load offset=36
@@ -8350,9 +8353,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $1)
)
)
(br $label$break$a)
@@ -8418,6 +8418,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $2)
+ (get_local $0)
+ (get_local $4)
(i32.add
(i32.and
(i32.load offset=36
@@ -8427,9 +8430,6 @@
)
(i32.const 2)
)
- (get_local $2)
- (get_local $0)
- (get_local $4)
)
(get_local $4)
)
@@ -8910,6 +8910,9 @@
(if
(i32.eq
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (get_local $6)
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=36
@@ -8919,9 +8922,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (get_local $6)
- (i32.const 1)
)
(i32.const 1)
)
@@ -8969,6 +8969,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load offset=36
@@ -8978,9 +8981,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.const 0)
- (i32.const 0)
)
)
(if
@@ -9029,6 +9029,12 @@
)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $0)
+ (i32.sub
+ (get_local $2)
+ (get_local $6)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load offset=40
@@ -9038,12 +9044,6 @@
)
(i32.const 2)
)
- (get_local $0)
- (i32.sub
- (get_local $2)
- (get_local $6)
- )
- (i32.const 1)
)
)
(i32.store offset=16
@@ -9911,6 +9911,9 @@
)
(func $lb (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(call_indirect $FUNCSIG$iiii
+ (get_local $1)
+ (get_local $2)
+ (get_local $3)
(i32.add
(i32.and
(get_local $0)
@@ -9918,9 +9921,6 @@
)
(i32.const 2)
)
- (get_local $1)
- (get_local $2)
- (get_local $3)
)
)
(func $Ea (param $0 i32) (result i32)
@@ -9993,6 +9993,7 @@
)
(func $kb (param $0 i32) (param $1 i32) (result i32)
(call_indirect $FUNCSIG$ii
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -10000,7 +10001,6 @@
)
(i32.const 0)
)
- (get_local $1)
)
)
(func $Sa (param $0 i32)
@@ -10017,6 +10017,7 @@
)
(func $mb (param $0 i32) (param $1 i32)
(call_indirect $FUNCSIG$vi
+ (get_local $1)
(i32.add
(i32.and
(get_local $0)
@@ -10024,7 +10025,6 @@
)
(i32.const 6)
)
- (get_local $1)
)
)
(func $Ha (param $0 i32) (param $1 i32)
diff --git a/test/memorygrowth.fromasm.imprecise.no-opts b/test/memorygrowth.fromasm.imprecise.no-opts
index 3dcf5fc53..be0a35505 100644
--- a/test/memorygrowth.fromasm.imprecise.no-opts
+++ b/test/memorygrowth.fromasm.imprecise.no-opts
@@ -9785,6 +9785,9 @@
(block
(set_local $h
(call_indirect $FUNCSIG$iiii
+ (get_local $c)
+ (get_local $a)
+ (get_local $b)
(i32.add
(i32.and
(i32.load
@@ -9797,9 +9800,6 @@
)
(i32.const 2)
)
- (get_local $c)
- (get_local $a)
- (get_local $b)
)
)
(br $label$break$a)
@@ -9872,6 +9872,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $c)
+ (get_local $a)
+ (get_local $q)
(i32.add
(i32.and
(i32.load
@@ -9884,9 +9887,6 @@
)
(i32.const 2)
)
- (get_local $c)
- (get_local $a)
- (get_local $q)
)
(get_local $q)
)
@@ -10493,6 +10493,9 @@
(if
(i32.eq
(call_indirect $FUNCSIG$iiii
+ (get_local $a)
+ (get_local $d)
+ (i32.const 1)
(i32.add
(i32.and
(i32.load
@@ -10505,9 +10508,6 @@
)
(i32.const 2)
)
- (get_local $a)
- (get_local $d)
- (i32.const 1)
)
(i32.const 1)
)
@@ -10563,6 +10563,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $a)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load
@@ -10575,9 +10578,6 @@
)
(i32.const 2)
)
- (get_local $a)
- (i32.const 0)
- (i32.const 0)
)
)
(if
@@ -10632,6 +10632,12 @@
(get_local $h)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $a)
+ (i32.sub
+ (get_local $f)
+ (get_local $h)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load
@@ -10644,12 +10650,6 @@
)
(i32.const 2)
)
- (get_local $a)
- (i32.sub
- (get_local $f)
- (get_local $h)
- )
- (i32.const 1)
)
)
(i32.store
@@ -11772,6 +11772,9 @@
(func $lb (param $a i32) (param $b i32) (param $c i32) (param $d i32) (result i32)
(return
(call_indirect $FUNCSIG$iiii
+ (get_local $b)
+ (get_local $c)
+ (get_local $d)
(i32.add
(i32.and
(get_local $a)
@@ -11779,9 +11782,6 @@
)
(i32.const 2)
)
- (get_local $b)
- (get_local $c)
- (get_local $d)
)
)
)
@@ -11862,6 +11862,7 @@
(func $kb (param $a i32) (param $b i32) (result i32)
(return
(call_indirect $FUNCSIG$ii
+ (get_local $b)
(i32.add
(i32.and
(get_local $a)
@@ -11869,7 +11870,6 @@
)
(i32.const 0)
)
- (get_local $b)
)
)
)
@@ -11891,6 +11891,7 @@
)
(func $mb (param $a i32) (param $b i32)
(call_indirect $FUNCSIG$vi
+ (get_local $b)
(i32.add
(i32.and
(get_local $a)
@@ -11898,7 +11899,6 @@
)
(i32.const 6)
)
- (get_local $b)
)
)
(func $Ha (param $a i32) (param $b i32)
diff --git a/test/memorygrowth.fromasm.no-opts b/test/memorygrowth.fromasm.no-opts
index 0f4b278c2..166cd316c 100644
--- a/test/memorygrowth.fromasm.no-opts
+++ b/test/memorygrowth.fromasm.no-opts
@@ -9786,6 +9786,9 @@
(block
(set_local $h
(call_indirect $FUNCSIG$iiii
+ (get_local $c)
+ (get_local $a)
+ (get_local $b)
(i32.add
(i32.and
(i32.load
@@ -9798,9 +9801,6 @@
)
(i32.const 2)
)
- (get_local $c)
- (get_local $a)
- (get_local $b)
)
)
(br $label$break$a)
@@ -9873,6 +9873,9 @@
(if
(i32.lt_u
(call_indirect $FUNCSIG$iiii
+ (get_local $c)
+ (get_local $a)
+ (get_local $q)
(i32.add
(i32.and
(i32.load
@@ -9885,9 +9888,6 @@
)
(i32.const 2)
)
- (get_local $c)
- (get_local $a)
- (get_local $q)
)
(get_local $q)
)
@@ -10494,6 +10494,9 @@
(if
(i32.eq
(call_indirect $FUNCSIG$iiii
+ (get_local $a)
+ (get_local $d)
+ (i32.const 1)
(i32.add
(i32.and
(i32.load
@@ -10506,9 +10509,6 @@
)
(i32.const 2)
)
- (get_local $a)
- (get_local $d)
- (i32.const 1)
)
(i32.const 1)
)
@@ -10564,6 +10564,9 @@
(block
(drop
(call_indirect $FUNCSIG$iiii
+ (get_local $a)
+ (i32.const 0)
+ (i32.const 0)
(i32.add
(i32.and
(i32.load
@@ -10576,9 +10579,6 @@
)
(i32.const 2)
)
- (get_local $a)
- (i32.const 0)
- (i32.const 0)
)
)
(if
@@ -10633,6 +10633,12 @@
(get_local $h)
)
(call_indirect $FUNCSIG$iiii
+ (get_local $a)
+ (i32.sub
+ (get_local $f)
+ (get_local $h)
+ )
+ (i32.const 1)
(i32.add
(i32.and
(i32.load
@@ -10645,12 +10651,6 @@
)
(i32.const 2)
)
- (get_local $a)
- (i32.sub
- (get_local $f)
- (get_local $h)
- )
- (i32.const 1)
)
)
(i32.store
@@ -11773,6 +11773,9 @@
(func $lb (param $a i32) (param $b i32) (param $c i32) (param $d i32) (result i32)
(return
(call_indirect $FUNCSIG$iiii
+ (get_local $b)
+ (get_local $c)
+ (get_local $d)
(i32.add
(i32.and
(get_local $a)
@@ -11780,9 +11783,6 @@
)
(i32.const 2)
)
- (get_local $b)
- (get_local $c)
- (get_local $d)
)
)
)
@@ -11863,6 +11863,7 @@
(func $kb (param $a i32) (param $b i32) (result i32)
(return
(call_indirect $FUNCSIG$ii
+ (get_local $b)
(i32.add
(i32.and
(get_local $a)
@@ -11870,7 +11871,6 @@
)
(i32.const 0)
)
- (get_local $b)
)
)
)
@@ -11892,6 +11892,7 @@
)
(func $mb (param $a i32) (param $b i32)
(call_indirect $FUNCSIG$vi
+ (get_local $b)
(i32.add
(i32.and
(get_local $a)
@@ -11899,7 +11900,6 @@
)
(i32.const 6)
)
- (get_local $b)
)
)
(func $Ha (param $a i32) (param $b i32)
diff --git a/test/passes/dce.wast b/test/passes/dce.wast
index c7eb1145e..22ae25fbc 100644
--- a/test/passes/dce.wast
+++ b/test/passes/dce.wast
@@ -90,6 +90,7 @@
(drop
(i32.const 0)
)
+ (unreachable)
)
)
(if
@@ -102,6 +103,7 @@
(drop
(i32.const 0)
)
+ (unreachable)
)
)
(if
@@ -114,6 +116,7 @@
(drop
(i32.const 0)
)
+ (unreachable)
)
)
(block $out
diff --git a/test/passes/remove-unused-names_merge-blocks.txt b/test/passes/remove-unused-names_merge-blocks.txt
index a82bf489f..43bbaf582 100644
--- a/test/passes/remove-unused-names_merge-blocks.txt
+++ b/test/passes/remove-unused-names_merge-blocks.txt
@@ -702,19 +702,22 @@
(i32.const 50)
)
(drop
- (i32.const 10)
+ (i32.const 50)
)
(drop
- (i32.const 30)
+ (i32.const 10)
)
(drop
- (i32.const 50)
+ (i32.const 30)
)
(call_indirect $ii
(i32.const 20)
(i32.const 40)
(i32.const 60)
)
+ (drop
+ (i32.const 50)
+ )
(call_indirect $ii
(unreachable)
(block
@@ -723,12 +726,7 @@
)
(i32.const 40)
)
- (block
- (drop
- (i32.const 50)
- )
- (i32.const 60)
- )
+ (i32.const 60)
)
)
(func $block-type-change (type $3)
diff --git a/test/unit.fromasm b/test/unit.fromasm
index 5a790c92f..edb9f5ece 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -229,22 +229,22 @@
(func $neg
(local $0 f32)
(call_indirect $FUNCSIG$vf
+ (f32.neg
+ (get_local $0)
+ )
(i32.add
(i32.const 1)
(i32.const 8)
)
- (f32.neg
- (get_local $0)
- )
)
)
(func $cneg (param $0 f32)
(call_indirect $FUNCSIG$vf
+ (get_local $0)
(i32.add
(i32.const 1)
(i32.const 8)
)
- (get_local $0)
)
)
(func $smallCompare (result i32)
@@ -278,11 +278,11 @@
)
(func $cneg_nosemicolon
(call_indirect $FUNCSIG$vi
+ (i32.const 1)
(i32.add
(i32.const 1)
(i32.const 8)
)
- (i32.const 1)
)
)
(func $forLoop
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index f81663fa1..abb6c3317 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -211,22 +211,22 @@
(func $neg
(local $0 f32)
(call_indirect $FUNCSIG$vf
+ (f32.neg
+ (get_local $0)
+ )
(i32.add
(i32.const 1)
(i32.const 8)
)
- (f32.neg
- (get_local $0)
- )
)
)
(func $cneg (param $0 f32)
(call_indirect $FUNCSIG$vf
+ (get_local $0)
(i32.add
(i32.const 1)
(i32.const 8)
)
- (get_local $0)
)
)
(func $smallCompare (result i32)
@@ -260,11 +260,11 @@
)
(func $cneg_nosemicolon
(call_indirect $FUNCSIG$vi
+ (i32.const 1)
(i32.add
(i32.const 1)
(i32.const 8)
)
- (i32.const 1)
)
)
(func $forLoop
diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts
index 083e6f888..b7f63c67b 100644
--- a/test/unit.fromasm.imprecise.no-opts
+++ b/test/unit.fromasm.imprecise.no-opts
@@ -414,6 +414,7 @@
)
)
(call_indirect $FUNCSIG$vf
+ (get_local $x)
(i32.add
(i32.and
(i32.const 1)
@@ -421,11 +422,11 @@
)
(i32.const 8)
)
- (get_local $x)
)
)
(func $cneg (param $x f32)
(call_indirect $FUNCSIG$vf
+ (get_local $x)
(i32.add
(i32.and
(i32.const 1)
@@ -433,7 +434,6 @@
)
(i32.const 8)
)
- (get_local $x)
)
)
(func $___syscall_ret
@@ -478,6 +478,7 @@
)
(func $cneg_nosemicolon
(call_indirect $FUNCSIG$vi
+ (i32.const 1)
(i32.add
(i32.and
(i32.const 1)
@@ -485,7 +486,6 @@
)
(i32.const 8)
)
- (i32.const 1)
)
)
(func $forLoop
diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts
index 3f561465a..55966a172 100644
--- a/test/unit.fromasm.no-opts
+++ b/test/unit.fromasm.no-opts
@@ -420,6 +420,7 @@
)
)
(call_indirect $FUNCSIG$vf
+ (get_local $x)
(i32.add
(i32.and
(i32.const 1)
@@ -427,11 +428,11 @@
)
(i32.const 8)
)
- (get_local $x)
)
)
(func $cneg (param $x f32)
(call_indirect $FUNCSIG$vf
+ (get_local $x)
(i32.add
(i32.and
(i32.const 1)
@@ -439,7 +440,6 @@
)
(i32.const 8)
)
- (get_local $x)
)
)
(func $___syscall_ret
@@ -484,6 +484,7 @@
)
(func $cneg_nosemicolon
(call_indirect $FUNCSIG$vi
+ (i32.const 1)
(i32.add
(i32.and
(i32.const 1)
@@ -491,7 +492,6 @@
)
(i32.const 8)
)
- (i32.const 1)
)
)
(func $forLoop
diff --git a/test/unit.wast b/test/unit.wast
index aece78930..b4105ed0b 100644
--- a/test/unit.wast
+++ b/test/unit.wast
@@ -378,6 +378,7 @@
)
)
(call_indirect $FUNCSIG$vf
+ (get_local $x)
(i32.add
(i32.and
(i32.const 1)
@@ -385,12 +386,12 @@
)
(i32.const 8)
)
- (get_local $x)
)
)
)
(func $cneg (type $FUNCSIG$vf) (param $x f32)
(call_indirect $FUNCSIG$vf
+ (get_local $x)
(i32.add
(i32.and
(i32.const 1)
@@ -398,7 +399,6 @@
)
(i32.const 8)
)
- (get_local $x)
)
)
(func $___syscall_ret (type $FUNCSIG$v)
diff --git a/test/unit.wast.fromBinary b/test/unit.wast.fromBinary
index 621f9aeb6..971b89fb7 100644
--- a/test/unit.wast.fromBinary
+++ b/test/unit.wast.fromBinary
@@ -386,6 +386,7 @@
)
)
(call_indirect $0
+ (get_local $var$0)
(i32.add
(i32.and
(i32.const 1)
@@ -393,12 +394,12 @@
)
(i32.const 8)
)
- (get_local $var$0)
)
)
)
(func $cneg (type $0) (param $var$0 f32)
(call_indirect $0
+ (get_local $var$0)
(i32.add
(i32.and
(i32.const 1)
@@ -406,7 +407,6 @@
)
(i32.const 8)
)
- (get_local $var$0)
)
)
(func $___syscall_ret (type $1)