summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/passes/RemoveUnusedBrs.cpp148
-rw-r--r--test/emcc_O2_hello_world.fromasm946
-rw-r--r--test/emcc_O2_hello_world.fromasm.imprecise946
-rw-r--r--test/emcc_hello_world.fromasm1217
-rw-r--r--test/emcc_hello_world.fromasm.imprecise1217
-rw-r--r--test/memorygrowth.fromasm849
-rw-r--r--test/memorygrowth.fromasm.imprecise849
-rw-r--r--test/passes/remove-unused-brs.txt93
-rw-r--r--test/passes/remove-unused-brs.wast73
-rw-r--r--test/unit.fromasm1
-rw-r--r--test/unit.fromasm.imprecise1
11 files changed, 3084 insertions, 3256 deletions
diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp
index cfd9ea7ce..255d86b9c 100644
--- a/src/passes/RemoveUnusedBrs.cpp
+++ b/src/passes/RemoveUnusedBrs.cpp
@@ -15,89 +15,119 @@
*/
//
-// Removes branches that go to where they go anyhow
+// Removes branches for which we go to where they go anyhow
//
#include <wasm.h>
#include <pass.h>
+#include <ast_utils.h>
namespace wasm {
struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs, Visitor<RemoveUnusedBrs>>> {
bool isFunctionParallel() { return true; }
- // preparation: try to unify branches, as the fewer there are, the higher a chance we can remove them
- // specifically for if-else, turn an if-else with branches to the same target at the end of each
- // child, and with a value, to a branch to that target containing the if-else
+ typedef std::vector<Break*> Flows;
+
+ // list of breaks that are currently flowing. if they reach their target without
+ // interference, they can be removed (or their value forwarded TODO)
+ Flows flows;
+
+ // a stack for if-else contents, we merge their outputs
+ std::vector<Flows> ifStack;
+
+ static void visitAny(RemoveUnusedBrs* self, Expression** currp) {
+ auto* curr = *currp;
+ auto& flows = self->flows;
+
+ if (curr->is<Break>()) {
+ flows.clear();
+ auto* br = curr->cast<Break>();
+ if (!br->condition && !br->value) { // TODO: optimize in those cases?
+ // a break, let's see where it flows to
+ flows.push_back(br);
+ }
+ } else if (curr->is<Switch>()) {
+ flows.clear();
+ } else if (curr->is<If>()) {
+ auto* iff = curr->cast<If>();
+ if (iff->ifFalse) {
+ assert(self->ifStack.size() > 0);
+ for (auto* flow : self->ifStack.back()) {
+ flows.push_back(flow);
+ }
+ self->ifStack.pop_back();
+ }
+ } else if (curr->is<Block>()) {
+ // any breaks flowing to here are unnecessary, as we get here anyhow
+ auto name = curr->cast<Block>()->name;
+ if (name.is()) {
+ size_t size = flows.size();
+ size_t skip = 0;
+ for (size_t i = 0; i < size; i++) {
+ if (flows[i]->name == name) {
+ ExpressionManipulator::nop(flows[i]);
+ skip++;
+ } else if (skip > 0) {
+ flows[i - skip] = flows[i];
+ }
+ }
+ if (skip > 0) {
+ flows.resize(size - skip);
+ }
+ }
+ } else if (curr->is<Loop>()) {
+ // TODO we might optimize branches out of here
+ flows.clear();
+ } else {
+ // anything else stops the flow
+ flows.clear();
+ }
+ }
+
+ static void clear(RemoveUnusedBrs* self, Expression** currp) {
+ self->flows.clear();
+ }
+
+ static void saveIfTrue(RemoveUnusedBrs* self, Expression** currp) {
+ self->ifStack.push_back(std::move(self->flows));
+ }
+
void visitIf(If* curr) {
if (!curr->ifFalse) {
- // try to reduce an if (condition) br => br_if (condition) , which might open up other optimization opportunities
+ // if without an else. try to reduce if (condition) br => br_if (condition)
Break* br = curr->ifTrue->dynCast<Break>();
if (br && !br->condition) { // TODO: if there is a condition, join them
br->condition = curr->condition;
replaceCurrent(br);
}
- return;
- }
- if (isConcreteWasmType(curr->type)) return; // already has a returned value
- // an if_else that indirectly returns a value by breaking to the same target can potentially remove both breaks, and break outside once
- auto getLast = [](Expression *side) -> Expression* {
- Block* b = side->dynCast<Block>();
- if (!b) return nullptr;
- if (b->list.size() == 0) return nullptr;
- return b->list.back();
- };
- auto process = [&](Expression *side, bool doIt) {
- Expression* last = getLast(side);
- if (!last) return Name();
- Block* b = side->cast<Block>();
- Break* br = last->dynCast<Break>();
- if (!br) return Name();
- if (br->condition) return Name();
- if (!br->value) return Name();
- if (doIt) {
- b->list[b->list.size()-1] = br->value;
- }
- return br->name;
- };
- // do both, or none
- if (process(curr->ifTrue, false).is() && process(curr->ifTrue, false) == process(curr->ifFalse, false)) {
- auto br = getLast(curr->ifTrue)->cast<Break>(); // we are about to discard this, so why not reuse it!
- process(curr->ifTrue, true);
- process(curr->ifFalse, true);
- curr->type = br->value->type; // if_else now returns a value
- br->value = curr;
- // no need to change anything else in the br - target is correct already
- replaceCurrent(br);
}
}
- // main portion
- void visitBlock(Block *curr) {
- if (curr->name.isNull()) return;
- if (curr->list.size() == 0) return;
- // preparation - remove all code after an unconditional break, since it can't execute, and it might confuse us (we look at the last)
- for (size_t i = 0; i < curr->list.size()-1; i++) {
- Break* br = curr->list[i]->dynCast<Break>();
- if (br && !br->condition) {
- curr->list.resize(i+1);
- break;
- }
- }
- Expression* last = curr->list.back();
- if (Break* br = last->dynCast<Break>()) {
- if (br->condition) return;
- if (br->name == curr->name) {
- if (!br->value) {
- curr->list.pop_back();
- } else {
- curr->list[curr->list.size()-1] = br->value; // can replace with the value
- }
+ // override scan to add a pre and a post check task to all nodes
+ static void scan(RemoveUnusedBrs* self, Expression** currp) {
+ self->pushTask(visitAny, currp);
+
+ auto* iff = (*currp)->dynCast<If>();
+
+ if (iff) {
+ self->pushTask(doVisitIf, currp);
+ if (iff->ifFalse) {
+ // we need to join up if-else control flow, and clear after the condition
+ self->pushTask(scan, &iff->ifFalse);
+ self->pushTask(saveIfTrue, currp); // safe the ifTrue flow, we'll join it later
}
+ self->pushTask(scan, &iff->ifTrue);
+ self->pushTask(clear, currp); // clear all flow after the condition
+ self->pushTask(scan, &iff->condition);
+ } else {
+ WalkerPass<PostWalker<RemoveUnusedBrs, Visitor<RemoveUnusedBrs>>>::scan(self, currp);
}
}
+
+ // TODO: multiple rounds?
};
-static RegisterPass<RemoveUnusedBrs> registerPass("remove-unused-brs", "removes breaks from locations that are never branched to");
+static RegisterPass<RemoveUnusedBrs> registerPass("remove-unused-brs", "removes breaks from locations that are not needed");
} // namespace wasm
diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm
index de6dfd4b8..ce017ac82 100644
--- a/test/emcc_O2_hello_world.fromasm
+++ b/test/emcc_O2_hello_world.fromasm
@@ -217,59 +217,56 @@
)
)
)
- (block $do-once$2
- (if
- (i32.ne
- (get_local $i7)
- (get_local $i11)
- )
- (block
- (if
- (i32.lt_u
- (get_local $i11)
- (i32.load
- (i32.const 192)
- )
+ (if
+ (i32.ne
+ (get_local $i7)
+ (get_local $i11)
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $i11)
+ (i32.load
+ (i32.const 192)
)
- (call_import $_abort)
)
- (if
- (i32.eq
- (i32.load
- (set_local $i12
- (i32.add
- (get_local $i11)
- (i32.const 12)
- )
+ (call_import $_abort)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $i12
+ (i32.add
+ (get_local $i11)
+ (i32.const 12)
)
)
- (get_local $i9)
)
- (block
- (i32.store
- (get_local $i12)
- (get_local $i7)
- )
- (i32.store
- (get_local $i8)
- (get_local $i11)
- )
- (br $do-once$2)
+ (get_local $i9)
+ )
+ (block
+ (i32.store
+ (get_local $i12)
+ (get_local $i7)
+ )
+ (i32.store
+ (get_local $i8)
+ (get_local $i11)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
- (i32.store
- (i32.const 176)
- (i32.and
- (get_local $i4)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $i6)
- )
- (i32.const -1)
+ )
+ (i32.store
+ (i32.const 176)
+ (i32.and
+ (get_local $i4)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $i6)
)
+ (i32.const -1)
)
)
)
@@ -462,70 +459,67 @@
)
)
)
- (block $do-once$4
- (if
- (i32.ne
- (get_local $i15)
- (get_local $i7)
- )
- (block
- (if
- (i32.lt_u
- (get_local $i7)
- (i32.load
- (i32.const 192)
- )
+ (if
+ (i32.ne
+ (get_local $i15)
+ (get_local $i7)
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $i7)
+ (i32.load
+ (i32.const 192)
)
- (call_import $_abort)
)
- (if
- (i32.eq
- (i32.load
- (set_local $i11
- (i32.add
- (get_local $i7)
- (i32.const 12)
- )
+ (call_import $_abort)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $i11
+ (i32.add
+ (get_local $i7)
+ (i32.const 12)
)
)
- (get_local $i14)
)
- (block
- (i32.store
- (get_local $i11)
- (get_local $i15)
- )
- (i32.store
- (get_local $i16)
- (get_local $i7)
- )
- (set_local $i18
- (i32.load
- (i32.const 184)
- )
+ (get_local $i14)
+ )
+ (block
+ (i32.store
+ (get_local $i11)
+ (get_local $i15)
+ )
+ (i32.store
+ (get_local $i16)
+ (get_local $i7)
+ )
+ (set_local $i18
+ (i32.load
+ (i32.const 184)
)
- (br $do-once$4)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
- (block
- (i32.store
- (i32.const 176)
- (i32.and
- (get_local $i4)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $i17)
- )
- (i32.const -1)
+ )
+ (block
+ (i32.store
+ (i32.const 176)
+ (i32.and
+ (get_local $i4)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $i17)
)
+ (i32.const -1)
)
)
- (set_local $i18
- (get_local $i8)
- )
+ )
+ (set_local $i18
+ (get_local $i8)
)
)
)
@@ -1015,7 +1009,6 @@
(set_local $i24
(get_local $i27)
)
- (br $do-once$8)
)
)
)
@@ -1069,7 +1062,6 @@
(set_local $i24
(get_local $i12)
)
- (br $do-once$8)
)
(call_import $_abort)
)
@@ -1181,29 +1173,26 @@
(get_local $i24)
(get_local $i5)
)
- (block $do-once$14
+ (if
+ (set_local $i7
+ (i32.load offset=16
+ (get_local $i22)
+ )
+ )
(if
- (set_local $i7
- (i32.load offset=16
- (get_local $i22)
- )
+ (i32.lt_u
+ (get_local $i7)
+ (get_local $i12)
)
- (if
- (i32.lt_u
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i24)
(get_local $i7)
- (get_local $i12)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i24)
- (get_local $i7)
- )
- (i32.store offset=24
- (get_local $i7)
- (get_local $i24)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $i7)
+ (get_local $i24)
)
)
)
@@ -1231,7 +1220,6 @@
(get_local $i7)
(get_local $i24)
)
- (br $do-once$12)
)
)
)
@@ -2194,7 +2182,6 @@
(set_local $i45
(get_local $i48)
)
- (br $do-once$21)
)
)
)
@@ -2248,7 +2235,6 @@
(set_local $i45
(get_local $i7)
)
- (br $do-once$21)
)
(call_import $_abort)
)
@@ -2360,29 +2346,26 @@
(get_local $i45)
(get_local $i3)
)
- (block $do-once$27
+ (if
+ (set_local $i15
+ (i32.load offset=16
+ (get_local $i44)
+ )
+ )
(if
- (set_local $i15
- (i32.load offset=16
- (get_local $i44)
- )
+ (i32.lt_u
+ (get_local $i15)
+ (get_local $i7)
)
- (if
- (i32.lt_u
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i45)
(get_local $i15)
- (get_local $i7)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i45)
- (get_local $i15)
- )
- (i32.store offset=24
- (get_local $i15)
- (get_local $i45)
- )
- (br $do-once$27)
+ (i32.store offset=24
+ (get_local $i15)
+ (get_local $i45)
)
)
)
@@ -2410,7 +2393,6 @@
(get_local $i15)
(get_local $i45)
)
- (br $do-once$25)
)
)
)
@@ -2838,7 +2820,6 @@
(get_local $i8)
(get_local $i8)
)
- (br $do-once$29)
)
)
(if
@@ -2891,7 +2872,6 @@
(get_local $i8)
(i32.const 0)
)
- (br $do-once$29)
)
(call_import $_abort)
)
@@ -3112,64 +3092,61 @@
)
)
)
- (block $do-once$33
- (if
- (i32.eqz
- (i32.load
- (i32.const 648)
- )
+ (if
+ (i32.eqz
+ (i32.load
+ (i32.const 648)
)
- (if
- (i32.and
- (i32.add
- (set_local $i53
- (call_import $_sysconf
- (i32.const 30)
- )
+ )
+ (if
+ (i32.and
+ (i32.add
+ (set_local $i53
+ (call_import $_sysconf
+ (i32.const 30)
)
- (i32.const -1)
)
+ (i32.const -1)
+ )
+ (get_local $i53)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store
+ (i32.const 656)
(get_local $i53)
)
- (call_import $_abort)
- (block
- (i32.store
- (i32.const 656)
- (get_local $i53)
- )
- (i32.store
- (i32.const 652)
- (get_local $i53)
- )
- (i32.store
- (i32.const 660)
- (i32.const -1)
- )
- (i32.store
- (i32.const 664)
- (i32.const -1)
- )
- (i32.store
- (i32.const 668)
- (i32.const 0)
- )
- (i32.store
- (i32.const 620)
- (i32.const 0)
- )
- (i32.store
- (i32.const 648)
- (i32.xor
- (i32.and
- (call_import $_time
- (i32.const 0)
- )
- (i32.const -16)
+ (i32.store
+ (i32.const 652)
+ (get_local $i53)
+ )
+ (i32.store
+ (i32.const 660)
+ (i32.const -1)
+ )
+ (i32.store
+ (i32.const 664)
+ (i32.const -1)
+ )
+ (i32.store
+ (i32.const 668)
+ (i32.const 0)
+ )
+ (i32.store
+ (i32.const 620)
+ (i32.const 0)
+ )
+ (i32.store
+ (i32.const 648)
+ (i32.xor
+ (i32.and
+ (call_import $_time
+ (i32.const 0)
)
- (i32.const 1431655768)
+ (i32.const -16)
)
+ (i32.const 1431655768)
)
- (br $do-once$33)
)
)
)
@@ -3545,76 +3522,71 @@
(get_local $i61)
)
)
- (block $do-once$42
+ (if
(if
- (if
+ (i32.and
+ (i32.gt_u
+ (get_local $i53)
+ (get_local $i61)
+ )
(i32.and
- (i32.gt_u
- (get_local $i53)
+ (i32.lt_u
(get_local $i61)
+ (i32.const 2147483647)
)
- (i32.and
- (i32.lt_u
- (get_local $i61)
- (i32.const 2147483647)
- )
- (i32.ne
- (get_local $i60)
- (i32.const -1)
- )
+ (i32.ne
+ (get_local $i60)
+ (i32.const -1)
)
)
- (i32.lt_u
- (set_local $i5
- (i32.and
- (i32.add
- (i32.sub
- (get_local $i44)
- (get_local $i61)
- )
- (set_local $i52
- (i32.load
- (i32.const 656)
- )
- )
- )
+ )
+ (i32.lt_u
+ (set_local $i5
+ (i32.and
+ (i32.add
(i32.sub
- (i32.const 0)
- (get_local $i52)
+ (get_local $i44)
+ (get_local $i61)
)
+ (set_local $i52
+ (i32.load
+ (i32.const 656)
+ )
+ )
+ )
+ (i32.sub
+ (i32.const 0)
+ (get_local $i52)
)
)
- (i32.const 2147483647)
)
- (i32.const 0)
+ (i32.const 2147483647)
)
- (if
- (i32.eq
- (call_import $_sbrk
- (get_local $i5)
- )
- (i32.const -1)
- )
- (block
- (call_import $_sbrk
- (get_local $i45)
- )
- (br $label$break$L279)
+ (i32.const 0)
+ )
+ (if
+ (i32.eq
+ (call_import $_sbrk
+ (get_local $i5)
)
- (block
- (set_local $i63
- (i32.add
- (get_local $i5)
- (get_local $i61)
- )
- )
- (br $do-once$42)
+ (i32.const -1)
+ )
+ (block
+ (call_import $_sbrk
+ (get_local $i45)
)
+ (br $label$break$L279)
)
(set_local $i63
- (get_local $i61)
+ (i32.add
+ (get_local $i5)
+ (get_local $i61)
+ )
)
)
+ (set_local $i63
+ (get_local $i61)
+ )
)
(if
(i32.ne
@@ -4306,7 +4278,6 @@
(set_local $i72
(get_local $i75)
)
- (br $do-once$53)
)
)
)
@@ -4360,7 +4331,6 @@
(set_local $i72
(get_local $i55)
)
- (br $do-once$53)
)
(call_import $_abort)
)
@@ -4471,34 +4441,31 @@
(get_local $i72)
(get_local $i54)
)
- (block $do-once$59
- (if
- (set_local $i45
- (i32.load
- (set_local $i5
- (i32.add
- (get_local $i43)
- (i32.const 16)
- )
+ (if
+ (set_local $i45
+ (i32.load
+ (set_local $i5
+ (i32.add
+ (get_local $i43)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $i45)
+ (get_local $i55)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i72)
(get_local $i45)
- (get_local $i55)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i72)
- (get_local $i45)
- )
- (i32.store offset=24
- (get_local $i45)
- (get_local $i72)
- )
- (br $do-once$59)
+ (i32.store offset=24
+ (get_local $i45)
+ (get_local $i72)
)
)
)
@@ -4529,7 +4496,6 @@
(get_local $i45)
(get_local $i72)
)
- (br $label$break$L331)
)
)
)
@@ -5113,7 +5079,6 @@
(get_local $i63)
(get_local $i63)
)
- (br $do-once$50)
)
)
(if
@@ -5166,7 +5131,6 @@
(get_local $i63)
(i32.const 0)
)
- (br $do-once$50)
)
(call_import $_abort)
)
@@ -5857,7 +5821,6 @@
(get_local $i60)
(get_local $i60)
)
- (br $do-once$44)
)
)
(if
@@ -5910,7 +5873,6 @@
(get_local $i60)
(i32.const 0)
)
- (br $do-once$44)
)
(call_import $_abort)
)
@@ -6598,7 +6560,6 @@
(set_local $i18
(get_local $i21)
)
- (br $do-once$2)
)
)
)
@@ -6652,7 +6613,6 @@
(set_local $i18
(get_local $i10)
)
- (br $do-once$2)
)
(call_import $_abort)
)
@@ -6778,34 +6738,31 @@
(get_local $i18)
(get_local $i7)
)
- (block $do-once$6
- (if
- (set_local $i14
- (i32.load
- (set_local $i11
- (i32.add
- (get_local $i8)
- (i32.const 16)
- )
+ (if
+ (set_local $i14
+ (i32.load
+ (set_local $i11
+ (i32.add
+ (get_local $i8)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $i14)
+ (get_local $i10)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i18)
(get_local $i14)
- (get_local $i10)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i18)
- (get_local $i14)
- )
- (i32.store offset=24
- (get_local $i14)
- (get_local $i18)
- )
- (br $do-once$6)
+ (i32.store offset=24
+ (get_local $i14)
+ (get_local $i18)
)
)
)
@@ -6839,7 +6796,6 @@
(set_local $i13
(get_local $i9)
)
- (br $do-once$0)
)
)
(block
@@ -7164,7 +7120,6 @@
(set_local $i23
(get_local $i26)
)
- (br $do-once$10)
)
)
)
@@ -7220,7 +7175,6 @@
(set_local $i23
(get_local $i22)
)
- (br $do-once$10)
)
(call_import $_abort)
)
@@ -7331,34 +7285,31 @@
(get_local $i23)
(get_local $i21)
)
- (block $do-once$14
- (if
- (set_local $i8
- (i32.load
- (set_local $i9
- (i32.add
- (get_local $i6)
- (i32.const 16)
- )
+ (if
+ (set_local $i8
+ (i32.load
+ (set_local $i9
+ (i32.add
+ (get_local $i6)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $i8)
+ (get_local $i22)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i23)
(get_local $i8)
- (get_local $i22)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i23)
- (get_local $i8)
- )
- (i32.store offset=24
- (get_local $i8)
- (get_local $i23)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $i8)
+ (get_local $i23)
)
)
)
@@ -7386,7 +7337,6 @@
(get_local $i8)
(get_local $i23)
)
- (br $do-once$8)
)
)
)
@@ -7773,228 +7723,224 @@
(get_local $i12)
(i32.const 0)
)
- (block $do-once$16
- (if
- (i32.and
- (set_local $i30
- (i32.load
- (i32.const 180)
- )
+ (if
+ (i32.and
+ (set_local $i30
+ (i32.load
+ (i32.const 180)
)
- (set_local $i18
- (i32.shl
- (i32.const 1)
- (get_local $i32)
- )
+ )
+ (set_local $i18
+ (i32.shl
+ (i32.const 1)
+ (get_local $i32)
)
)
- (block
- (set_local $i31
- (i32.shl
- (get_local $i29)
- (if
- (i32.eq
+ )
+ (block
+ (set_local $i31
+ (i32.shl
+ (get_local $i29)
+ (if
+ (i32.eq
+ (get_local $i32)
+ (i32.const 31)
+ )
+ (i32.const 0)
+ (i32.sub
+ (i32.const 25)
+ (i32.shr_u
(get_local $i32)
- (i32.const 31)
- )
- (i32.const 0)
- (i32.sub
- (i32.const 25)
- (i32.shr_u
- (get_local $i32)
- (i32.const 1)
- )
+ (i32.const 1)
)
)
)
)
- (set_local $i2
- (i32.load
- (get_local $i5)
- )
+ )
+ (set_local $i2
+ (i32.load
+ (get_local $i5)
)
- (loop $while-out$18 $while-in$19
- (if
- (i32.eq
- (i32.and
- (i32.load offset=4
- (get_local $i2)
- )
- (i32.const -8)
- )
- (get_local $i29)
- )
- (block
- (set_local $i33
+ )
+ (loop $while-out$18 $while-in$19
+ (if
+ (i32.eq
+ (i32.and
+ (i32.load offset=4
(get_local $i2)
)
- (set_local $i34
- (i32.const 130)
- )
- (br $while-out$18)
+ (i32.const -8)
)
+ (get_local $i29)
)
- (if
- (set_local $i13
- (i32.load
- (set_local $i28
+ (block
+ (set_local $i33
+ (get_local $i2)
+ )
+ (set_local $i34
+ (i32.const 130)
+ )
+ (br $while-out$18)
+ )
+ )
+ (if
+ (set_local $i13
+ (i32.load
+ (set_local $i28
+ (i32.add
(i32.add
- (i32.add
- (get_local $i2)
- (i32.const 16)
- )
- (i32.shl
- (i32.shr_u
- (get_local $i31)
- (i32.const 31)
- )
- (i32.const 2)
+ (get_local $i2)
+ (i32.const 16)
+ )
+ (i32.shl
+ (i32.shr_u
+ (get_local $i31)
+ (i32.const 31)
)
+ (i32.const 2)
)
)
)
)
- (block
- (set_local $i31
- (i32.shl
- (get_local $i31)
- (i32.const 1)
- )
- )
- (set_local $i2
- (get_local $i13)
+ )
+ (block
+ (set_local $i31
+ (i32.shl
+ (get_local $i31)
+ (i32.const 1)
)
)
- (block
- (set_local $i35
- (get_local $i28)
- )
- (set_local $i36
- (get_local $i2)
- )
- (set_local $i34
- (i32.const 127)
- )
- (br $while-out$18)
+ (set_local $i2
+ (get_local $i13)
+ )
+ )
+ (block
+ (set_local $i35
+ (get_local $i28)
+ )
+ (set_local $i36
+ (get_local $i2)
+ )
+ (set_local $i34
+ (i32.const 127)
+ )
+ (br $while-out$18)
+ )
+ )
+ (br $while-in$19)
+ )
+ (if
+ (i32.eq
+ (get_local $i34)
+ (i32.const 127)
+ )
+ (if
+ (i32.lt_u
+ (get_local $i35)
+ (i32.load
+ (i32.const 192)
+ )
+ )
+ (call_import $_abort)
+ (block
+ (i32.store
+ (get_local $i35)
+ (get_local $i12)
+ )
+ (i32.store offset=24
+ (get_local $i12)
+ (get_local $i36)
+ )
+ (i32.store offset=12
+ (get_local $i12)
+ (get_local $i12)
+ )
+ (i32.store offset=8
+ (get_local $i12)
+ (get_local $i12)
)
)
- (br $while-in$19)
)
(if
(i32.eq
(get_local $i34)
- (i32.const 127)
+ (i32.const 130)
)
(if
- (i32.lt_u
- (get_local $i35)
- (i32.load
- (i32.const 192)
+ (i32.and
+ (i32.ge_u
+ (set_local $i31
+ (i32.load
+ (set_local $i2
+ (i32.add
+ (get_local $i33)
+ (i32.const 8)
+ )
+ )
+ )
+ )
+ (set_local $i9
+ (i32.load
+ (i32.const 192)
+ )
+ )
+ )
+ (i32.ge_u
+ (get_local $i33)
+ (get_local $i9)
)
)
- (call_import $_abort)
(block
+ (i32.store offset=12
+ (get_local $i31)
+ (get_local $i12)
+ )
(i32.store
- (get_local $i35)
+ (get_local $i2)
(get_local $i12)
)
- (i32.store offset=24
+ (i32.store offset=8
(get_local $i12)
- (get_local $i36)
+ (get_local $i31)
)
(i32.store offset=12
(get_local $i12)
- (get_local $i12)
+ (get_local $i33)
)
- (i32.store offset=8
- (get_local $i12)
+ (i32.store offset=24
(get_local $i12)
+ (i32.const 0)
)
- (br $do-once$16)
- )
- )
- (if
- (i32.eq
- (get_local $i34)
- (i32.const 130)
- )
- (if
- (i32.and
- (i32.ge_u
- (set_local $i31
- (i32.load
- (set_local $i2
- (i32.add
- (get_local $i33)
- (i32.const 8)
- )
- )
- )
- )
- (set_local $i9
- (i32.load
- (i32.const 192)
- )
- )
- )
- (i32.ge_u
- (get_local $i33)
- (get_local $i9)
- )
- )
- (block
- (i32.store offset=12
- (get_local $i31)
- (get_local $i12)
- )
- (i32.store
- (get_local $i2)
- (get_local $i12)
- )
- (i32.store offset=8
- (get_local $i12)
- (get_local $i31)
- )
- (i32.store offset=12
- (get_local $i12)
- (get_local $i33)
- )
- (i32.store offset=24
- (get_local $i12)
- (i32.const 0)
- )
- (br $do-once$16)
- )
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
)
- (block
- (i32.store
- (i32.const 180)
- (i32.or
- (get_local $i30)
- (get_local $i18)
- )
- )
- (i32.store
- (get_local $i5)
- (get_local $i12)
- )
- (i32.store offset=24
- (get_local $i12)
- (get_local $i5)
- )
- (i32.store offset=12
- (get_local $i12)
- (get_local $i12)
- )
- (i32.store offset=8
- (get_local $i12)
- (get_local $i12)
+ )
+ (block
+ (i32.store
+ (i32.const 180)
+ (i32.or
+ (get_local $i30)
+ (get_local $i18)
)
)
+ (i32.store
+ (get_local $i5)
+ (get_local $i12)
+ )
+ (i32.store offset=24
+ (get_local $i12)
+ (get_local $i5)
+ )
+ (i32.store offset=12
+ (get_local $i12)
+ (get_local $i12)
+ )
+ (i32.store offset=8
+ (get_local $i12)
+ (get_local $i12)
+ )
)
)
(i32.store
diff --git a/test/emcc_O2_hello_world.fromasm.imprecise b/test/emcc_O2_hello_world.fromasm.imprecise
index de6dfd4b8..ce017ac82 100644
--- a/test/emcc_O2_hello_world.fromasm.imprecise
+++ b/test/emcc_O2_hello_world.fromasm.imprecise
@@ -217,59 +217,56 @@
)
)
)
- (block $do-once$2
- (if
- (i32.ne
- (get_local $i7)
- (get_local $i11)
- )
- (block
- (if
- (i32.lt_u
- (get_local $i11)
- (i32.load
- (i32.const 192)
- )
+ (if
+ (i32.ne
+ (get_local $i7)
+ (get_local $i11)
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $i11)
+ (i32.load
+ (i32.const 192)
)
- (call_import $_abort)
)
- (if
- (i32.eq
- (i32.load
- (set_local $i12
- (i32.add
- (get_local $i11)
- (i32.const 12)
- )
+ (call_import $_abort)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $i12
+ (i32.add
+ (get_local $i11)
+ (i32.const 12)
)
)
- (get_local $i9)
)
- (block
- (i32.store
- (get_local $i12)
- (get_local $i7)
- )
- (i32.store
- (get_local $i8)
- (get_local $i11)
- )
- (br $do-once$2)
+ (get_local $i9)
+ )
+ (block
+ (i32.store
+ (get_local $i12)
+ (get_local $i7)
+ )
+ (i32.store
+ (get_local $i8)
+ (get_local $i11)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
- (i32.store
- (i32.const 176)
- (i32.and
- (get_local $i4)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $i6)
- )
- (i32.const -1)
+ )
+ (i32.store
+ (i32.const 176)
+ (i32.and
+ (get_local $i4)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $i6)
)
+ (i32.const -1)
)
)
)
@@ -462,70 +459,67 @@
)
)
)
- (block $do-once$4
- (if
- (i32.ne
- (get_local $i15)
- (get_local $i7)
- )
- (block
- (if
- (i32.lt_u
- (get_local $i7)
- (i32.load
- (i32.const 192)
- )
+ (if
+ (i32.ne
+ (get_local $i15)
+ (get_local $i7)
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $i7)
+ (i32.load
+ (i32.const 192)
)
- (call_import $_abort)
)
- (if
- (i32.eq
- (i32.load
- (set_local $i11
- (i32.add
- (get_local $i7)
- (i32.const 12)
- )
+ (call_import $_abort)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $i11
+ (i32.add
+ (get_local $i7)
+ (i32.const 12)
)
)
- (get_local $i14)
)
- (block
- (i32.store
- (get_local $i11)
- (get_local $i15)
- )
- (i32.store
- (get_local $i16)
- (get_local $i7)
- )
- (set_local $i18
- (i32.load
- (i32.const 184)
- )
+ (get_local $i14)
+ )
+ (block
+ (i32.store
+ (get_local $i11)
+ (get_local $i15)
+ )
+ (i32.store
+ (get_local $i16)
+ (get_local $i7)
+ )
+ (set_local $i18
+ (i32.load
+ (i32.const 184)
)
- (br $do-once$4)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
- (block
- (i32.store
- (i32.const 176)
- (i32.and
- (get_local $i4)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $i17)
- )
- (i32.const -1)
+ )
+ (block
+ (i32.store
+ (i32.const 176)
+ (i32.and
+ (get_local $i4)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $i17)
)
+ (i32.const -1)
)
)
- (set_local $i18
- (get_local $i8)
- )
+ )
+ (set_local $i18
+ (get_local $i8)
)
)
)
@@ -1015,7 +1009,6 @@
(set_local $i24
(get_local $i27)
)
- (br $do-once$8)
)
)
)
@@ -1069,7 +1062,6 @@
(set_local $i24
(get_local $i12)
)
- (br $do-once$8)
)
(call_import $_abort)
)
@@ -1181,29 +1173,26 @@
(get_local $i24)
(get_local $i5)
)
- (block $do-once$14
+ (if
+ (set_local $i7
+ (i32.load offset=16
+ (get_local $i22)
+ )
+ )
(if
- (set_local $i7
- (i32.load offset=16
- (get_local $i22)
- )
+ (i32.lt_u
+ (get_local $i7)
+ (get_local $i12)
)
- (if
- (i32.lt_u
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i24)
(get_local $i7)
- (get_local $i12)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i24)
- (get_local $i7)
- )
- (i32.store offset=24
- (get_local $i7)
- (get_local $i24)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $i7)
+ (get_local $i24)
)
)
)
@@ -1231,7 +1220,6 @@
(get_local $i7)
(get_local $i24)
)
- (br $do-once$12)
)
)
)
@@ -2194,7 +2182,6 @@
(set_local $i45
(get_local $i48)
)
- (br $do-once$21)
)
)
)
@@ -2248,7 +2235,6 @@
(set_local $i45
(get_local $i7)
)
- (br $do-once$21)
)
(call_import $_abort)
)
@@ -2360,29 +2346,26 @@
(get_local $i45)
(get_local $i3)
)
- (block $do-once$27
+ (if
+ (set_local $i15
+ (i32.load offset=16
+ (get_local $i44)
+ )
+ )
(if
- (set_local $i15
- (i32.load offset=16
- (get_local $i44)
- )
+ (i32.lt_u
+ (get_local $i15)
+ (get_local $i7)
)
- (if
- (i32.lt_u
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i45)
(get_local $i15)
- (get_local $i7)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i45)
- (get_local $i15)
- )
- (i32.store offset=24
- (get_local $i15)
- (get_local $i45)
- )
- (br $do-once$27)
+ (i32.store offset=24
+ (get_local $i15)
+ (get_local $i45)
)
)
)
@@ -2410,7 +2393,6 @@
(get_local $i15)
(get_local $i45)
)
- (br $do-once$25)
)
)
)
@@ -2838,7 +2820,6 @@
(get_local $i8)
(get_local $i8)
)
- (br $do-once$29)
)
)
(if
@@ -2891,7 +2872,6 @@
(get_local $i8)
(i32.const 0)
)
- (br $do-once$29)
)
(call_import $_abort)
)
@@ -3112,64 +3092,61 @@
)
)
)
- (block $do-once$33
- (if
- (i32.eqz
- (i32.load
- (i32.const 648)
- )
+ (if
+ (i32.eqz
+ (i32.load
+ (i32.const 648)
)
- (if
- (i32.and
- (i32.add
- (set_local $i53
- (call_import $_sysconf
- (i32.const 30)
- )
+ )
+ (if
+ (i32.and
+ (i32.add
+ (set_local $i53
+ (call_import $_sysconf
+ (i32.const 30)
)
- (i32.const -1)
)
+ (i32.const -1)
+ )
+ (get_local $i53)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store
+ (i32.const 656)
(get_local $i53)
)
- (call_import $_abort)
- (block
- (i32.store
- (i32.const 656)
- (get_local $i53)
- )
- (i32.store
- (i32.const 652)
- (get_local $i53)
- )
- (i32.store
- (i32.const 660)
- (i32.const -1)
- )
- (i32.store
- (i32.const 664)
- (i32.const -1)
- )
- (i32.store
- (i32.const 668)
- (i32.const 0)
- )
- (i32.store
- (i32.const 620)
- (i32.const 0)
- )
- (i32.store
- (i32.const 648)
- (i32.xor
- (i32.and
- (call_import $_time
- (i32.const 0)
- )
- (i32.const -16)
+ (i32.store
+ (i32.const 652)
+ (get_local $i53)
+ )
+ (i32.store
+ (i32.const 660)
+ (i32.const -1)
+ )
+ (i32.store
+ (i32.const 664)
+ (i32.const -1)
+ )
+ (i32.store
+ (i32.const 668)
+ (i32.const 0)
+ )
+ (i32.store
+ (i32.const 620)
+ (i32.const 0)
+ )
+ (i32.store
+ (i32.const 648)
+ (i32.xor
+ (i32.and
+ (call_import $_time
+ (i32.const 0)
)
- (i32.const 1431655768)
+ (i32.const -16)
)
+ (i32.const 1431655768)
)
- (br $do-once$33)
)
)
)
@@ -3545,76 +3522,71 @@
(get_local $i61)
)
)
- (block $do-once$42
+ (if
(if
- (if
+ (i32.and
+ (i32.gt_u
+ (get_local $i53)
+ (get_local $i61)
+ )
(i32.and
- (i32.gt_u
- (get_local $i53)
+ (i32.lt_u
(get_local $i61)
+ (i32.const 2147483647)
)
- (i32.and
- (i32.lt_u
- (get_local $i61)
- (i32.const 2147483647)
- )
- (i32.ne
- (get_local $i60)
- (i32.const -1)
- )
+ (i32.ne
+ (get_local $i60)
+ (i32.const -1)
)
)
- (i32.lt_u
- (set_local $i5
- (i32.and
- (i32.add
- (i32.sub
- (get_local $i44)
- (get_local $i61)
- )
- (set_local $i52
- (i32.load
- (i32.const 656)
- )
- )
- )
+ )
+ (i32.lt_u
+ (set_local $i5
+ (i32.and
+ (i32.add
(i32.sub
- (i32.const 0)
- (get_local $i52)
+ (get_local $i44)
+ (get_local $i61)
)
+ (set_local $i52
+ (i32.load
+ (i32.const 656)
+ )
+ )
+ )
+ (i32.sub
+ (i32.const 0)
+ (get_local $i52)
)
)
- (i32.const 2147483647)
)
- (i32.const 0)
+ (i32.const 2147483647)
)
- (if
- (i32.eq
- (call_import $_sbrk
- (get_local $i5)
- )
- (i32.const -1)
- )
- (block
- (call_import $_sbrk
- (get_local $i45)
- )
- (br $label$break$L279)
+ (i32.const 0)
+ )
+ (if
+ (i32.eq
+ (call_import $_sbrk
+ (get_local $i5)
)
- (block
- (set_local $i63
- (i32.add
- (get_local $i5)
- (get_local $i61)
- )
- )
- (br $do-once$42)
+ (i32.const -1)
+ )
+ (block
+ (call_import $_sbrk
+ (get_local $i45)
)
+ (br $label$break$L279)
)
(set_local $i63
- (get_local $i61)
+ (i32.add
+ (get_local $i5)
+ (get_local $i61)
+ )
)
)
+ (set_local $i63
+ (get_local $i61)
+ )
)
(if
(i32.ne
@@ -4306,7 +4278,6 @@
(set_local $i72
(get_local $i75)
)
- (br $do-once$53)
)
)
)
@@ -4360,7 +4331,6 @@
(set_local $i72
(get_local $i55)
)
- (br $do-once$53)
)
(call_import $_abort)
)
@@ -4471,34 +4441,31 @@
(get_local $i72)
(get_local $i54)
)
- (block $do-once$59
- (if
- (set_local $i45
- (i32.load
- (set_local $i5
- (i32.add
- (get_local $i43)
- (i32.const 16)
- )
+ (if
+ (set_local $i45
+ (i32.load
+ (set_local $i5
+ (i32.add
+ (get_local $i43)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $i45)
+ (get_local $i55)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i72)
(get_local $i45)
- (get_local $i55)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i72)
- (get_local $i45)
- )
- (i32.store offset=24
- (get_local $i45)
- (get_local $i72)
- )
- (br $do-once$59)
+ (i32.store offset=24
+ (get_local $i45)
+ (get_local $i72)
)
)
)
@@ -4529,7 +4496,6 @@
(get_local $i45)
(get_local $i72)
)
- (br $label$break$L331)
)
)
)
@@ -5113,7 +5079,6 @@
(get_local $i63)
(get_local $i63)
)
- (br $do-once$50)
)
)
(if
@@ -5166,7 +5131,6 @@
(get_local $i63)
(i32.const 0)
)
- (br $do-once$50)
)
(call_import $_abort)
)
@@ -5857,7 +5821,6 @@
(get_local $i60)
(get_local $i60)
)
- (br $do-once$44)
)
)
(if
@@ -5910,7 +5873,6 @@
(get_local $i60)
(i32.const 0)
)
- (br $do-once$44)
)
(call_import $_abort)
)
@@ -6598,7 +6560,6 @@
(set_local $i18
(get_local $i21)
)
- (br $do-once$2)
)
)
)
@@ -6652,7 +6613,6 @@
(set_local $i18
(get_local $i10)
)
- (br $do-once$2)
)
(call_import $_abort)
)
@@ -6778,34 +6738,31 @@
(get_local $i18)
(get_local $i7)
)
- (block $do-once$6
- (if
- (set_local $i14
- (i32.load
- (set_local $i11
- (i32.add
- (get_local $i8)
- (i32.const 16)
- )
+ (if
+ (set_local $i14
+ (i32.load
+ (set_local $i11
+ (i32.add
+ (get_local $i8)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $i14)
+ (get_local $i10)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i18)
(get_local $i14)
- (get_local $i10)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i18)
- (get_local $i14)
- )
- (i32.store offset=24
- (get_local $i14)
- (get_local $i18)
- )
- (br $do-once$6)
+ (i32.store offset=24
+ (get_local $i14)
+ (get_local $i18)
)
)
)
@@ -6839,7 +6796,6 @@
(set_local $i13
(get_local $i9)
)
- (br $do-once$0)
)
)
(block
@@ -7164,7 +7120,6 @@
(set_local $i23
(get_local $i26)
)
- (br $do-once$10)
)
)
)
@@ -7220,7 +7175,6 @@
(set_local $i23
(get_local $i22)
)
- (br $do-once$10)
)
(call_import $_abort)
)
@@ -7331,34 +7285,31 @@
(get_local $i23)
(get_local $i21)
)
- (block $do-once$14
- (if
- (set_local $i8
- (i32.load
- (set_local $i9
- (i32.add
- (get_local $i6)
- (i32.const 16)
- )
+ (if
+ (set_local $i8
+ (i32.load
+ (set_local $i9
+ (i32.add
+ (get_local $i6)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $i8)
+ (get_local $i22)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $i23)
(get_local $i8)
- (get_local $i22)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $i23)
- (get_local $i8)
- )
- (i32.store offset=24
- (get_local $i8)
- (get_local $i23)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $i8)
+ (get_local $i23)
)
)
)
@@ -7386,7 +7337,6 @@
(get_local $i8)
(get_local $i23)
)
- (br $do-once$8)
)
)
)
@@ -7773,228 +7723,224 @@
(get_local $i12)
(i32.const 0)
)
- (block $do-once$16
- (if
- (i32.and
- (set_local $i30
- (i32.load
- (i32.const 180)
- )
+ (if
+ (i32.and
+ (set_local $i30
+ (i32.load
+ (i32.const 180)
)
- (set_local $i18
- (i32.shl
- (i32.const 1)
- (get_local $i32)
- )
+ )
+ (set_local $i18
+ (i32.shl
+ (i32.const 1)
+ (get_local $i32)
)
)
- (block
- (set_local $i31
- (i32.shl
- (get_local $i29)
- (if
- (i32.eq
+ )
+ (block
+ (set_local $i31
+ (i32.shl
+ (get_local $i29)
+ (if
+ (i32.eq
+ (get_local $i32)
+ (i32.const 31)
+ )
+ (i32.const 0)
+ (i32.sub
+ (i32.const 25)
+ (i32.shr_u
(get_local $i32)
- (i32.const 31)
- )
- (i32.const 0)
- (i32.sub
- (i32.const 25)
- (i32.shr_u
- (get_local $i32)
- (i32.const 1)
- )
+ (i32.const 1)
)
)
)
)
- (set_local $i2
- (i32.load
- (get_local $i5)
- )
+ )
+ (set_local $i2
+ (i32.load
+ (get_local $i5)
)
- (loop $while-out$18 $while-in$19
- (if
- (i32.eq
- (i32.and
- (i32.load offset=4
- (get_local $i2)
- )
- (i32.const -8)
- )
- (get_local $i29)
- )
- (block
- (set_local $i33
+ )
+ (loop $while-out$18 $while-in$19
+ (if
+ (i32.eq
+ (i32.and
+ (i32.load offset=4
(get_local $i2)
)
- (set_local $i34
- (i32.const 130)
- )
- (br $while-out$18)
+ (i32.const -8)
)
+ (get_local $i29)
)
- (if
- (set_local $i13
- (i32.load
- (set_local $i28
+ (block
+ (set_local $i33
+ (get_local $i2)
+ )
+ (set_local $i34
+ (i32.const 130)
+ )
+ (br $while-out$18)
+ )
+ )
+ (if
+ (set_local $i13
+ (i32.load
+ (set_local $i28
+ (i32.add
(i32.add
- (i32.add
- (get_local $i2)
- (i32.const 16)
- )
- (i32.shl
- (i32.shr_u
- (get_local $i31)
- (i32.const 31)
- )
- (i32.const 2)
+ (get_local $i2)
+ (i32.const 16)
+ )
+ (i32.shl
+ (i32.shr_u
+ (get_local $i31)
+ (i32.const 31)
)
+ (i32.const 2)
)
)
)
)
- (block
- (set_local $i31
- (i32.shl
- (get_local $i31)
- (i32.const 1)
- )
- )
- (set_local $i2
- (get_local $i13)
+ )
+ (block
+ (set_local $i31
+ (i32.shl
+ (get_local $i31)
+ (i32.const 1)
)
)
- (block
- (set_local $i35
- (get_local $i28)
- )
- (set_local $i36
- (get_local $i2)
- )
- (set_local $i34
- (i32.const 127)
- )
- (br $while-out$18)
+ (set_local $i2
+ (get_local $i13)
+ )
+ )
+ (block
+ (set_local $i35
+ (get_local $i28)
+ )
+ (set_local $i36
+ (get_local $i2)
+ )
+ (set_local $i34
+ (i32.const 127)
+ )
+ (br $while-out$18)
+ )
+ )
+ (br $while-in$19)
+ )
+ (if
+ (i32.eq
+ (get_local $i34)
+ (i32.const 127)
+ )
+ (if
+ (i32.lt_u
+ (get_local $i35)
+ (i32.load
+ (i32.const 192)
+ )
+ )
+ (call_import $_abort)
+ (block
+ (i32.store
+ (get_local $i35)
+ (get_local $i12)
+ )
+ (i32.store offset=24
+ (get_local $i12)
+ (get_local $i36)
+ )
+ (i32.store offset=12
+ (get_local $i12)
+ (get_local $i12)
+ )
+ (i32.store offset=8
+ (get_local $i12)
+ (get_local $i12)
)
)
- (br $while-in$19)
)
(if
(i32.eq
(get_local $i34)
- (i32.const 127)
+ (i32.const 130)
)
(if
- (i32.lt_u
- (get_local $i35)
- (i32.load
- (i32.const 192)
+ (i32.and
+ (i32.ge_u
+ (set_local $i31
+ (i32.load
+ (set_local $i2
+ (i32.add
+ (get_local $i33)
+ (i32.const 8)
+ )
+ )
+ )
+ )
+ (set_local $i9
+ (i32.load
+ (i32.const 192)
+ )
+ )
+ )
+ (i32.ge_u
+ (get_local $i33)
+ (get_local $i9)
)
)
- (call_import $_abort)
(block
+ (i32.store offset=12
+ (get_local $i31)
+ (get_local $i12)
+ )
(i32.store
- (get_local $i35)
+ (get_local $i2)
(get_local $i12)
)
- (i32.store offset=24
+ (i32.store offset=8
(get_local $i12)
- (get_local $i36)
+ (get_local $i31)
)
(i32.store offset=12
(get_local $i12)
- (get_local $i12)
+ (get_local $i33)
)
- (i32.store offset=8
- (get_local $i12)
+ (i32.store offset=24
(get_local $i12)
+ (i32.const 0)
)
- (br $do-once$16)
- )
- )
- (if
- (i32.eq
- (get_local $i34)
- (i32.const 130)
- )
- (if
- (i32.and
- (i32.ge_u
- (set_local $i31
- (i32.load
- (set_local $i2
- (i32.add
- (get_local $i33)
- (i32.const 8)
- )
- )
- )
- )
- (set_local $i9
- (i32.load
- (i32.const 192)
- )
- )
- )
- (i32.ge_u
- (get_local $i33)
- (get_local $i9)
- )
- )
- (block
- (i32.store offset=12
- (get_local $i31)
- (get_local $i12)
- )
- (i32.store
- (get_local $i2)
- (get_local $i12)
- )
- (i32.store offset=8
- (get_local $i12)
- (get_local $i31)
- )
- (i32.store offset=12
- (get_local $i12)
- (get_local $i33)
- )
- (i32.store offset=24
- (get_local $i12)
- (i32.const 0)
- )
- (br $do-once$16)
- )
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
)
- (block
- (i32.store
- (i32.const 180)
- (i32.or
- (get_local $i30)
- (get_local $i18)
- )
- )
- (i32.store
- (get_local $i5)
- (get_local $i12)
- )
- (i32.store offset=24
- (get_local $i12)
- (get_local $i5)
- )
- (i32.store offset=12
- (get_local $i12)
- (get_local $i12)
- )
- (i32.store offset=8
- (get_local $i12)
- (get_local $i12)
+ )
+ (block
+ (i32.store
+ (i32.const 180)
+ (i32.or
+ (get_local $i30)
+ (get_local $i18)
)
)
+ (i32.store
+ (get_local $i5)
+ (get_local $i12)
+ )
+ (i32.store offset=24
+ (get_local $i12)
+ (get_local $i5)
+ )
+ (i32.store offset=12
+ (get_local $i12)
+ (get_local $i12)
+ )
+ (i32.store offset=8
+ (get_local $i12)
+ (get_local $i12)
+ )
)
)
(i32.store
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm
index 387da4310..603d2c0bf 100644
--- a/test/emcc_hello_world.fromasm
+++ b/test/emcc_hello_world.fromasm
@@ -2526,7 +2526,6 @@
(set_local $$retval$0
(i32.const 4)
)
- (br $do-once$0)
)
(block
(i32.store
@@ -2536,7 +2535,6 @@
(set_local $$retval$0
(i32.const -1)
)
- (br $do-once$0)
)
)
)
@@ -3859,44 +3857,38 @@
(i32.const 0)
)
(loop $label$break$L1 $label$continue$L1
- (block $do-once$0
+ (if
+ (i32.gt_s
+ (get_local $$cnt$0)
+ (i32.const -1)
+ )
(if
(i32.gt_s
- (get_local $$cnt$0)
- (i32.const -1)
- )
- (if
- (i32.gt_s
- (get_local $$l$0)
- (i32.sub
- (i32.const 2147483647)
- (get_local $$cnt$0)
- )
+ (get_local $$l$0)
+ (i32.sub
+ (i32.const 2147483647)
+ (get_local $$cnt$0)
)
- (block
- (i32.store
- (call $___errno_location)
- (i32.const 75)
- )
- (set_local $$cnt$1
- (i32.const -1)
- )
- (br $do-once$0)
+ )
+ (block
+ (i32.store
+ (call $___errno_location)
+ (i32.const 75)
)
- (block
- (set_local $$cnt$1
- (i32.add
- (get_local $$l$0)
- (get_local $$cnt$0)
- )
- )
- (br $do-once$0)
+ (set_local $$cnt$1
+ (i32.const -1)
)
)
(set_local $$cnt$1
- (get_local $$cnt$0)
+ (i32.add
+ (get_local $$l$0)
+ (get_local $$cnt$0)
+ )
)
)
+ (set_local $$cnt$1
+ (get_local $$cnt$0)
+ )
)
(if
(i32.eq
@@ -6242,107 +6234,99 @@
(i32.const 2)
)
)
- (block $do-once$58
- (if
- (i32.or
- (i32.gt_u
- (get_local $$p$0)
- (i32.const 11)
- )
- (i32.eq
- (set_local $$sub74$i
- (i32.sub
- (i32.const 12)
- (get_local $$p$0)
- )
+ (if
+ (i32.or
+ (i32.gt_u
+ (get_local $$p$0)
+ (i32.const 11)
+ )
+ (i32.eq
+ (set_local $$sub74$i
+ (i32.sub
+ (i32.const 12)
+ (get_local $$p$0)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (set_local $$y$addr$1$i
- (get_local $$mul$i$240)
+ )
+ (set_local $$y$addr$1$i
+ (get_local $$mul$i$240)
+ )
+ (block
+ (set_local $$re$1482$i
+ (get_local $$sub74$i)
)
- (block
- (set_local $$re$1482$i
- (get_local $$sub74$i)
- )
- (set_local $$round$0481$i
- (f64.const 8)
+ (set_local $$round$0481$i
+ (f64.const 8)
+ )
+ (loop $while-out$60 $while-in$61
+ (set_local $$mul80$i
+ (f64.mul
+ (get_local $$round$0481$i)
+ (f64.const 16)
+ )
)
- (loop $while-out$60 $while-in$61
- (set_local $$mul80$i
- (f64.mul
- (get_local $$round$0481$i)
- (f64.const 16)
+ (if
+ (i32.eq
+ (set_local $$dec78$i
+ (i32.add
+ (get_local $$re$1482$i)
+ (i32.const -1)
+ )
)
+ (i32.const 0)
)
- (if
- (i32.eq
- (set_local $$dec78$i
- (i32.add
- (get_local $$re$1482$i)
- (i32.const -1)
- )
- )
- (i32.const 0)
+ (block
+ (set_local $$mul80$i$lcssa
+ (get_local $$mul80$i)
)
- (block
- (set_local $$mul80$i$lcssa
- (get_local $$mul80$i)
- )
- (br $while-out$60)
+ (br $while-out$60)
+ )
+ (block
+ (set_local $$re$1482$i
+ (get_local $$dec78$i)
)
- (block
- (set_local $$re$1482$i
- (get_local $$dec78$i)
- )
- (set_local $$round$0481$i
- (get_local $$mul80$i)
- )
+ (set_local $$round$0481$i
+ (get_local $$mul80$i)
)
)
- (br $while-in$61)
)
- (if
- (i32.eq
- (i32.shr_s
- (i32.shl
- (i32.load8_s
- (get_local $$prefix$0$add$ptr65$i)
- )
- (i32.const 24)
+ (br $while-in$61)
+ )
+ (if
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (i32.load8_s
+ (get_local $$prefix$0$add$ptr65$i)
)
(i32.const 24)
)
- (i32.const 45)
- )
- (block
- (set_local $$y$addr$1$i
- (f64.neg
- (f64.add
- (get_local $$mul80$i$lcssa)
- (f64.sub
- (f64.neg
- (get_local $$mul$i$240)
- )
- (get_local $$mul80$i$lcssa)
- )
- )
- )
- )
- (br $do-once$58)
+ (i32.const 24)
)
- (block
- (set_local $$y$addr$1$i
+ (i32.const 45)
+ )
+ (set_local $$y$addr$1$i
+ (f64.neg
+ (f64.add
+ (get_local $$mul80$i$lcssa)
(f64.sub
- (f64.add
+ (f64.neg
(get_local $$mul$i$240)
- (get_local $$mul80$i$lcssa)
)
(get_local $$mul80$i$lcssa)
)
)
- (br $do-once$58)
+ )
+ )
+ (set_local $$y$addr$1$i
+ (f64.sub
+ (f64.add
+ (get_local $$mul$i$240)
+ (get_local $$mul80$i$lcssa)
+ )
+ (get_local $$mul80$i$lcssa)
)
)
)
@@ -8282,7 +8266,6 @@
(set_local $$t$addr$1$i
(get_local $$t$addr$0$i)
)
- (br $do-once$98)
)
(block
(set_local $$$sub562$i
@@ -8322,7 +8305,6 @@
(set_local $$t$addr$1$i
(get_local $$t$addr$0$i)
)
- (br $do-once$98)
)
)
)
@@ -10928,7 +10910,6 @@
)
(br $label$break$L1)
)
- (br $label$break$L1)
)
)
)
@@ -11925,60 +11906,57 @@
)
)
)
- (block $do-once$2
- (if
- (i32.eq
- (get_local $$arrayidx)
- (get_local $$3)
- )
- (i32.store
- (i32.const 176)
- (i32.and
- (get_local $$0)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $$add8)
- )
- (i32.const -1)
+ (if
+ (i32.eq
+ (get_local $$arrayidx)
+ (get_local $$3)
+ )
+ (i32.store
+ (i32.const 176)
+ (i32.and
+ (get_local $$0)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $$add8)
)
+ (i32.const -1)
)
)
- (block
- (if
- (i32.lt_u
- (get_local $$3)
- (i32.load
- (i32.const 192)
- )
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $$3)
+ (i32.load
+ (i32.const 192)
)
- (call_import $_abort)
)
- (if
- (i32.eq
- (i32.load
- (set_local $$bk
- (i32.add
- (get_local $$3)
- (i32.const 12)
- )
+ (call_import $_abort)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $$bk
+ (i32.add
+ (get_local $$3)
+ (i32.const 12)
)
)
- (get_local $$2)
)
- (block
- (i32.store
- (get_local $$bk)
- (get_local $$arrayidx)
- )
- (i32.store
- (get_local $$1)
- (get_local $$3)
- )
- (br $do-once$2)
+ (get_local $$2)
+ )
+ (block
+ (i32.store
+ (get_local $$bk)
+ (get_local $$arrayidx)
+ )
+ (i32.store
+ (get_local $$1)
+ (get_local $$3)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
)
@@ -12184,70 +12162,67 @@
)
)
)
- (block $do-once$4
- (if
- (i32.eq
- (get_local $$arrayidx66)
- (get_local $$10)
- )
- (block
- (i32.store
- (i32.const 176)
- (i32.and
- (get_local $$0)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $$add64)
- )
- (i32.const -1)
+ (if
+ (i32.eq
+ (get_local $$arrayidx66)
+ (get_local $$10)
+ )
+ (block
+ (i32.store
+ (i32.const 176)
+ (i32.and
+ (get_local $$0)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $$add64)
)
+ (i32.const -1)
)
)
- (set_local $$13
- (get_local $$7)
- )
)
- (block
- (if
- (i32.lt_u
- (get_local $$10)
- (i32.load
- (i32.const 192)
- )
+ (set_local $$13
+ (get_local $$7)
+ )
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $$10)
+ (i32.load
+ (i32.const 192)
)
- (call_import $_abort)
)
- (if
- (i32.eq
- (i32.load
- (set_local $$bk78
- (i32.add
- (get_local $$10)
- (i32.const 12)
- )
+ (call_import $_abort)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $$bk78
+ (i32.add
+ (get_local $$10)
+ (i32.const 12)
)
)
- (get_local $$9)
)
- (block
- (i32.store
- (get_local $$bk78)
- (get_local $$arrayidx66)
- )
- (i32.store
- (get_local $$8)
- (get_local $$10)
- )
- (set_local $$13
- (i32.load
- (i32.const 184)
- )
+ (get_local $$9)
+ )
+ (block
+ (i32.store
+ (get_local $$bk78)
+ (get_local $$arrayidx66)
+ )
+ (i32.store
+ (get_local $$8)
+ (get_local $$10)
+ )
+ (set_local $$13
+ (i32.load
+ (i32.const 184)
)
- (br $do-once$4)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
)
@@ -12779,7 +12754,6 @@
(set_local $$R$3$i
(get_local $$R$1$i$lcssa)
)
- (br $do-once$8)
)
)
)
@@ -12835,7 +12809,6 @@
(set_local $$R$3$i
(get_local $$27)
)
- (br $do-once$8)
)
(call_import $_abort)
)
@@ -12954,34 +12927,31 @@
(get_local $$R$3$i)
(get_local $$26)
)
- (block $do-once$14
- (if
- (i32.eqz
- (i32.eq
- (set_local $$41
- (i32.load offset=16
- (get_local $$v$0$i$lcssa)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$41
+ (i32.load offset=16
+ (get_local $$v$0$i$lcssa)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$41)
+ (get_local $$40)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R$3$i)
(get_local $$41)
- (get_local $$40)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R$3$i)
- (get_local $$41)
- )
- (i32.store offset=24
- (get_local $$41)
- (get_local $$R$3$i)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $$41)
+ (get_local $$R$3$i)
)
)
)
@@ -13014,7 +12984,6 @@
(get_local $$42)
(get_local $$R$3$i)
)
- (br $do-once$12)
)
)
)
@@ -14052,7 +14021,6 @@
(set_local $$R$3$i$171
(get_local $$R$1$i$168$lcssa)
)
- (br $do-once$21)
)
)
)
@@ -14108,7 +14076,6 @@
(set_local $$R$3$i$171
(get_local $$64)
)
- (br $do-once$21)
)
(call_import $_abort)
)
@@ -14227,34 +14194,31 @@
(get_local $$R$3$i$171)
(get_local $$63)
)
- (block $do-once$27
- (if
- (i32.eqz
- (i32.eq
- (set_local $$78
- (i32.load offset=16
- (get_local $$v$4$lcssa$i)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$78
+ (i32.load offset=16
+ (get_local $$v$4$lcssa$i)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$78)
+ (get_local $$77)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R$3$i$171)
(get_local $$78)
- (get_local $$77)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R$3$i$171)
- (get_local $$78)
- )
- (i32.store offset=24
- (get_local $$78)
- (get_local $$R$3$i$171)
- )
- (br $do-once$27)
+ (i32.store offset=24
+ (get_local $$78)
+ (get_local $$R$3$i$171)
)
)
)
@@ -14287,7 +14251,6 @@
(get_local $$79)
(get_local $$R$3$i$171)
)
- (br $do-once$25)
)
)
)
@@ -14776,7 +14739,6 @@
(get_local $$add$ptr$i$161)
(get_local $$add$ptr$i$161)
)
- (br $do-once$29)
)
)
(if
@@ -14829,7 +14791,6 @@
(get_local $$add$ptr$i$161)
(i32.const 0)
)
- (br $do-once$29)
)
(call_import $_abort)
)
@@ -15019,70 +14980,67 @@
)
)
)
- (block $do-once$33
+ (if
+ (i32.eq
+ (i32.load
+ (i32.const 648)
+ )
+ (i32.const 0)
+ )
(if
(i32.eq
- (i32.load
- (i32.const 648)
- )
- (i32.const 0)
- )
- (if
- (i32.eq
- (i32.and
- (i32.add
- (set_local $$call$i$i
- (call_import $_sysconf
- (i32.const 30)
- )
+ (i32.and
+ (i32.add
+ (set_local $$call$i$i
+ (call_import $_sysconf
+ (i32.const 30)
)
- (i32.const -1)
)
- (get_local $$call$i$i)
+ (i32.const -1)
)
+ (get_local $$call$i$i)
+ )
+ (i32.const 0)
+ )
+ (block
+ (i32.store
+ (i32.const 656)
+ (get_local $$call$i$i)
+ )
+ (i32.store
+ (i32.const 652)
+ (get_local $$call$i$i)
+ )
+ (i32.store
+ (i32.const 660)
+ (i32.const -1)
+ )
+ (i32.store
+ (i32.const 664)
+ (i32.const -1)
+ )
+ (i32.store
+ (i32.const 668)
(i32.const 0)
)
- (block
- (i32.store
- (i32.const 656)
- (get_local $$call$i$i)
- )
- (i32.store
- (i32.const 652)
- (get_local $$call$i$i)
- )
- (i32.store
- (i32.const 660)
- (i32.const -1)
- )
- (i32.store
- (i32.const 664)
- (i32.const -1)
- )
- (i32.store
- (i32.const 668)
- (i32.const 0)
- )
- (i32.store
- (i32.const 620)
- (i32.const 0)
- )
- (i32.store
- (i32.const 648)
- (i32.xor
- (i32.and
- (call_import $_time
- (i32.const 0)
- )
- (i32.const -16)
+ (i32.store
+ (i32.const 620)
+ (i32.const 0)
+ )
+ (i32.store
+ (i32.const 648)
+ (i32.xor
+ (i32.and
+ (call_import $_time
+ (i32.const 0)
)
- (i32.const 1431655768)
+ (i32.const -16)
)
+ (i32.const 1431655768)
)
- (br $do-once$33)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
(set_local $$add$i$180
@@ -15474,78 +15432,73 @@
(get_local $$ssize$2$ph$i)
)
)
- (block $do-once$42
- (if
+ (if
+ (i32.and
+ (i32.gt_u
+ (get_local $$add$i$180)
+ (get_local $$ssize$2$ph$i)
+ )
(i32.and
- (i32.gt_u
- (get_local $$add$i$180)
+ (i32.lt_u
(get_local $$ssize$2$ph$i)
+ (i32.const 2147483647)
)
- (i32.and
- (i32.lt_u
- (get_local $$ssize$2$ph$i)
- (i32.const 2147483647)
- )
- (i32.ne
- (get_local $$br$2$ph$i)
- (i32.const -1)
- )
+ (i32.ne
+ (get_local $$br$2$ph$i)
+ (i32.const -1)
)
)
- (if
- (i32.lt_u
- (set_local $$and104$i
- (i32.and
- (i32.add
- (i32.sub
- (get_local $$sub$i$181)
- (get_local $$ssize$2$ph$i)
- )
- (set_local $$115
- (i32.load
- (i32.const 656)
- )
- )
- )
+ )
+ (if
+ (i32.lt_u
+ (set_local $$and104$i
+ (i32.and
+ (i32.add
(i32.sub
- (i32.const 0)
- (get_local $$115)
+ (get_local $$sub$i$181)
+ (get_local $$ssize$2$ph$i)
+ )
+ (set_local $$115
+ (i32.load
+ (i32.const 656)
+ )
)
)
- )
- (i32.const 2147483647)
- )
- (if
- (i32.eq
- (call_import $_sbrk
- (get_local $$and104$i)
+ (i32.sub
+ (i32.const 0)
+ (get_local $$115)
)
- (i32.const -1)
)
- (block
- (call_import $_sbrk
- (get_local $$sub112$i)
- )
- (br $label$break$L279)
+ )
+ (i32.const 2147483647)
+ )
+ (if
+ (i32.eq
+ (call_import $_sbrk
+ (get_local $$and104$i)
)
- (block
- (set_local $$ssize$5$i
- (i32.add
- (get_local $$and104$i)
- (get_local $$ssize$2$ph$i)
- )
- )
- (br $do-once$42)
+ (i32.const -1)
+ )
+ (block
+ (call_import $_sbrk
+ (get_local $$sub112$i)
)
+ (br $label$break$L279)
)
(set_local $$ssize$5$i
- (get_local $$ssize$2$ph$i)
+ (i32.add
+ (get_local $$and104$i)
+ (get_local $$ssize$2$ph$i)
+ )
)
)
(set_local $$ssize$5$i
(get_local $$ssize$2$ph$i)
)
)
+ (set_local $$ssize$5$i
+ (get_local $$ssize$2$ph$i)
+ )
)
(if
(i32.eqz
@@ -16603,7 +16556,6 @@
(set_local $$R$3$i$i
(get_local $$R$1$i$i$lcssa)
)
- (br $do-once$59)
)
)
)
@@ -16659,7 +16611,6 @@
(set_local $$R$3$i$i
(get_local $$155)
)
- (br $do-once$59)
)
(call_import $_abort)
)
@@ -16777,39 +16728,36 @@
(get_local $$R$3$i$i)
(get_local $$154)
)
- (block $do-once$65
- (if
- (i32.eqz
- (i32.eq
- (set_local $$169
- (i32.load
- (set_local $$child166$i$i
- (i32.add
- (get_local $$add$ptr16$i$i)
- (i32.const 16)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$169
+ (i32.load
+ (set_local $$child166$i$i
+ (i32.add
+ (get_local $$add$ptr16$i$i)
+ (i32.const 16)
)
)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$169)
+ (get_local $$168)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R$3$i$i)
(get_local $$169)
- (get_local $$168)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R$3$i$i)
- (get_local $$169)
- )
- (i32.store offset=24
- (get_local $$169)
- (get_local $$R$3$i$i)
- )
- (br $do-once$65)
+ (i32.store offset=24
+ (get_local $$169)
+ (get_local $$R$3$i$i)
)
)
)
@@ -16841,7 +16789,6 @@
(get_local $$170)
(get_local $$R$3$i$i)
)
- (br $label$break$L331)
)
)
)
@@ -17332,7 +17279,6 @@
(get_local $$add$ptr17$i$i)
(get_local $$add$ptr17$i$i)
)
- (br $do-once$52)
)
)
(if
@@ -17385,7 +17331,6 @@
(get_local $$add$ptr17$i$i)
(i32.const 0)
)
- (br $do-once$52)
)
(call_import $_abort)
)
@@ -18110,7 +18055,6 @@
(get_local $$119)
(get_local $$119)
)
- (br $do-once$44)
)
)
(if
@@ -18163,7 +18107,6 @@
(get_local $$119)
(i32.const 0)
)
- (br $do-once$44)
)
(call_import $_abort)
)
@@ -18812,7 +18755,6 @@
(set_local $$R$3
(get_local $$R$1$lcssa)
)
- (br $do-once$2)
)
)
)
@@ -18868,7 +18810,6 @@
(set_local $$R$3
(get_local $$10)
)
- (br $do-once$2)
)
(call_import $_abort)
)
@@ -19007,39 +18948,36 @@
(get_local $$R$3)
(get_local $$9)
)
- (block $do-once$6
- (if
- (i32.eqz
- (i32.eq
- (set_local $$24
- (i32.load
- (set_local $$child171
- (i32.add
- (get_local $$add$ptr16)
- (i32.const 16)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$24
+ (i32.load
+ (set_local $$child171
+ (i32.add
+ (get_local $$add$ptr16)
+ (i32.const 16)
)
)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$24)
+ (get_local $$23)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R$3)
(get_local $$24)
- (get_local $$23)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R$3)
- (get_local $$24)
- )
- (i32.store offset=24
- (get_local $$24)
- (get_local $$R$3)
- )
- (br $do-once$6)
+ (i32.store offset=24
+ (get_local $$24)
+ (get_local $$R$3)
)
)
)
@@ -19084,7 +19022,6 @@
(set_local $$psize$1
(get_local $$add17)
)
- (br $do-once$0)
)
)
)
@@ -19521,7 +19458,6 @@
(set_local $$R332$3
(get_local $$R332$1$lcssa)
)
- (br $do-once$10)
)
)
)
@@ -19579,7 +19515,6 @@
(set_local $$R332$3
(get_local $$42)
)
- (br $do-once$10)
)
(call_import $_abort)
)
@@ -19697,39 +19632,36 @@
(get_local $$R332$3)
(get_local $$41)
)
- (block $do-once$14
- (if
- (i32.eqz
- (i32.eq
- (set_local $$58
- (i32.load
- (set_local $$child443
- (i32.add
- (get_local $$add$ptr6)
- (i32.const 16)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$58
+ (i32.load
+ (set_local $$child443
+ (i32.add
+ (get_local $$add$ptr6)
+ (i32.const 16)
)
)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$58)
+ (get_local $$57)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R332$3)
(get_local $$58)
- (get_local $$57)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R332$3)
- (get_local $$58)
- )
- (i32.store offset=24
- (get_local $$58)
- (get_local $$R332$3)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $$58)
+ (get_local $$R332$3)
)
)
)
@@ -19762,7 +19694,6 @@
(get_local $$59)
(get_local $$R332$3)
)
- (br $do-once$8)
)
)
)
@@ -20066,243 +19997,239 @@
(get_local $$p$1)
(i32.const 0)
)
- (block $do-once$16
- (if
- (i32.eq
- (i32.and
- (set_local $$66
- (i32.load
- (i32.const 180)
- )
- )
- (set_local $$shl573
- (i32.shl
- (i32.const 1)
- (get_local $$I534$0)
- )
+ (if
+ (i32.eq
+ (i32.and
+ (set_local $$66
+ (i32.load
+ (i32.const 180)
)
)
- (i32.const 0)
- )
- (block
- (i32.store
- (i32.const 180)
- (i32.or
- (get_local $$66)
- (get_local $$shl573)
+ (set_local $$shl573
+ (i32.shl
+ (i32.const 1)
+ (get_local $$I534$0)
)
)
- (i32.store
- (get_local $$arrayidx567)
- (get_local $$p$1)
+ )
+ (i32.const 0)
+ )
+ (block
+ (i32.store
+ (i32.const 180)
+ (i32.or
+ (get_local $$66)
+ (get_local $$shl573)
)
- (i32.store offset=24
- (get_local $$p$1)
+ )
+ (i32.store
+ (get_local $$arrayidx567)
+ (get_local $$p$1)
+ )
+ (i32.store offset=24
+ (get_local $$p$1)
+ (get_local $$arrayidx567)
+ )
+ (i32.store offset=12
+ (get_local $$p$1)
+ (get_local $$p$1)
+ )
+ (i32.store offset=8
+ (get_local $$p$1)
+ (get_local $$p$1)
+ )
+ )
+ (block
+ (set_local $$67
+ (i32.load
(get_local $$arrayidx567)
)
- (i32.store offset=12
- (get_local $$p$1)
- (get_local $$p$1)
- )
- (i32.store offset=8
- (get_local $$p$1)
- (get_local $$p$1)
+ )
+ (set_local $$sub589
+ (i32.sub
+ (i32.const 25)
+ (i32.shr_u
+ (get_local $$I534$0)
+ (i32.const 1)
+ )
)
)
- (block
- (set_local $$67
- (i32.load
- (get_local $$arrayidx567)
+ (set_local $$cond
+ (if
+ (i32.eq
+ (get_local $$I534$0)
+ (i32.const 31)
)
+ (i32.const 0)
+ (get_local $$sub589)
)
- (set_local $$sub589
- (i32.sub
- (i32.const 25)
- (i32.shr_u
- (get_local $$I534$0)
- (i32.const 1)
+ )
+ (set_local $$K583$0
+ (i32.shl
+ (get_local $$psize$2)
+ (get_local $$cond)
+ )
+ )
+ (set_local $$T$0
+ (get_local $$67)
+ )
+ (loop $while-out$18 $while-in$19
+ (if
+ (i32.eq
+ (i32.and
+ (i32.load offset=4
+ (get_local $$T$0)
+ )
+ (i32.const -8)
)
+ (get_local $$psize$2)
)
- )
- (set_local $$cond
- (if
- (i32.eq
- (get_local $$I534$0)
- (i32.const 31)
+ (block
+ (set_local $$T$0$lcssa
+ (get_local $$T$0)
)
- (i32.const 0)
- (get_local $$sub589)
+ (set_local $label
+ (i32.const 130)
+ )
+ (br $while-out$18)
)
)
- (set_local $$K583$0
+ (set_local $$shl600
(i32.shl
- (get_local $$psize$2)
- (get_local $$cond)
+ (get_local $$K583$0)
+ (i32.const 1)
)
)
- (set_local $$T$0
- (get_local $$67)
- )
- (loop $while-out$18 $while-in$19
- (if
- (i32.eq
- (i32.and
- (i32.load offset=4
- (get_local $$T$0)
+ (if
+ (i32.eq
+ (set_local $$69
+ (i32.load
+ (set_local $$arrayidx599
+ (i32.add
+ (i32.add
+ (get_local $$T$0)
+ (i32.const 16)
+ )
+ (i32.shl
+ (i32.shr_u
+ (get_local $$K583$0)
+ (i32.const 31)
+ )
+ (i32.const 2)
+ )
+ )
)
- (i32.const -8)
)
- (get_local $$psize$2)
)
- (block
- (set_local $$T$0$lcssa
- (get_local $$T$0)
- )
- (set_local $label
- (i32.const 130)
- )
- (br $while-out$18)
+ (i32.const 0)
+ )
+ (block
+ (set_local $$T$0$lcssa319
+ (get_local $$T$0)
)
+ (set_local $$arrayidx599$lcssa
+ (get_local $$arrayidx599)
+ )
+ (set_local $label
+ (i32.const 127)
+ )
+ (br $while-out$18)
)
- (set_local $$shl600
- (i32.shl
- (get_local $$K583$0)
- (i32.const 1)
+ (block
+ (set_local $$K583$0
+ (get_local $$shl600)
+ )
+ (set_local $$T$0
+ (get_local $$69)
)
)
- (if
- (i32.eq
- (set_local $$69
- (i32.load
- (set_local $$arrayidx599
- (i32.add
- (i32.add
- (get_local $$T$0)
- (i32.const 16)
- )
- (i32.shl
- (i32.shr_u
- (get_local $$K583$0)
- (i32.const 31)
- )
- (i32.const 2)
- )
- )
- )
- )
- )
- (i32.const 0)
+ )
+ (br $while-in$19)
+ )
+ (if
+ (i32.eq
+ (get_local $label)
+ (i32.const 127)
+ )
+ (if
+ (i32.lt_u
+ (get_local $$arrayidx599$lcssa)
+ (i32.load
+ (i32.const 192)
)
- (block
- (set_local $$T$0$lcssa319
- (get_local $$T$0)
- )
- (set_local $$arrayidx599$lcssa
- (get_local $$arrayidx599)
- )
- (set_local $label
- (i32.const 127)
- )
- (br $while-out$18)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store
+ (get_local $$arrayidx599$lcssa)
+ (get_local $$p$1)
)
- (block
- (set_local $$K583$0
- (get_local $$shl600)
- )
- (set_local $$T$0
- (get_local $$69)
- )
+ (i32.store offset=24
+ (get_local $$p$1)
+ (get_local $$T$0$lcssa319)
+ )
+ (i32.store offset=12
+ (get_local $$p$1)
+ (get_local $$p$1)
+ )
+ (i32.store offset=8
+ (get_local $$p$1)
+ (get_local $$p$1)
)
)
- (br $while-in$19)
)
(if
(i32.eq
(get_local $label)
- (i32.const 127)
+ (i32.const 130)
)
(if
- (i32.lt_u
- (get_local $$arrayidx599$lcssa)
- (i32.load
- (i32.const 192)
+ (i32.and
+ (i32.ge_u
+ (set_local $$71
+ (i32.load
+ (set_local $$fd620
+ (i32.add
+ (get_local $$T$0$lcssa)
+ (i32.const 8)
+ )
+ )
+ )
+ )
+ (set_local $$72
+ (i32.load
+ (i32.const 192)
+ )
+ )
+ )
+ (i32.ge_u
+ (get_local $$T$0$lcssa)
+ (get_local $$72)
)
)
- (call_import $_abort)
(block
+ (i32.store offset=12
+ (get_local $$71)
+ (get_local $$p$1)
+ )
(i32.store
- (get_local $$arrayidx599$lcssa)
+ (get_local $$fd620)
(get_local $$p$1)
)
- (i32.store offset=24
+ (i32.store offset=8
(get_local $$p$1)
- (get_local $$T$0$lcssa319)
+ (get_local $$71)
)
(i32.store offset=12
(get_local $$p$1)
- (get_local $$p$1)
+ (get_local $$T$0$lcssa)
)
- (i32.store offset=8
- (get_local $$p$1)
+ (i32.store offset=24
(get_local $$p$1)
+ (i32.const 0)
)
- (br $do-once$16)
- )
- )
- (if
- (i32.eq
- (get_local $label)
- (i32.const 130)
- )
- (if
- (i32.and
- (i32.ge_u
- (set_local $$71
- (i32.load
- (set_local $$fd620
- (i32.add
- (get_local $$T$0$lcssa)
- (i32.const 8)
- )
- )
- )
- )
- (set_local $$72
- (i32.load
- (i32.const 192)
- )
- )
- )
- (i32.ge_u
- (get_local $$T$0$lcssa)
- (get_local $$72)
- )
- )
- (block
- (i32.store offset=12
- (get_local $$71)
- (get_local $$p$1)
- )
- (i32.store
- (get_local $$fd620)
- (get_local $$p$1)
- )
- (i32.store offset=8
- (get_local $$p$1)
- (get_local $$71)
- )
- (i32.store offset=12
- (get_local $$p$1)
- (get_local $$T$0$lcssa)
- )
- (i32.store offset=24
- (get_local $$p$1)
- (i32.const 0)
- )
- (br $do-once$16)
- )
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
)
diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise
index 6fcffbf53..b8890f5ed 100644
--- a/test/emcc_hello_world.fromasm.imprecise
+++ b/test/emcc_hello_world.fromasm.imprecise
@@ -2524,7 +2524,6 @@
(set_local $$retval$0
(i32.const 4)
)
- (br $do-once$0)
)
(block
(i32.store
@@ -2534,7 +2533,6 @@
(set_local $$retval$0
(i32.const -1)
)
- (br $do-once$0)
)
)
)
@@ -3857,44 +3855,38 @@
(i32.const 0)
)
(loop $label$break$L1 $label$continue$L1
- (block $do-once$0
+ (if
+ (i32.gt_s
+ (get_local $$cnt$0)
+ (i32.const -1)
+ )
(if
(i32.gt_s
- (get_local $$cnt$0)
- (i32.const -1)
- )
- (if
- (i32.gt_s
- (get_local $$l$0)
- (i32.sub
- (i32.const 2147483647)
- (get_local $$cnt$0)
- )
+ (get_local $$l$0)
+ (i32.sub
+ (i32.const 2147483647)
+ (get_local $$cnt$0)
)
- (block
- (i32.store
- (call $___errno_location)
- (i32.const 75)
- )
- (set_local $$cnt$1
- (i32.const -1)
- )
- (br $do-once$0)
+ )
+ (block
+ (i32.store
+ (call $___errno_location)
+ (i32.const 75)
)
- (block
- (set_local $$cnt$1
- (i32.add
- (get_local $$l$0)
- (get_local $$cnt$0)
- )
- )
- (br $do-once$0)
+ (set_local $$cnt$1
+ (i32.const -1)
)
)
(set_local $$cnt$1
- (get_local $$cnt$0)
+ (i32.add
+ (get_local $$l$0)
+ (get_local $$cnt$0)
+ )
)
)
+ (set_local $$cnt$1
+ (get_local $$cnt$0)
+ )
)
(if
(i32.eq
@@ -6240,107 +6232,99 @@
(i32.const 2)
)
)
- (block $do-once$58
- (if
- (i32.or
- (i32.gt_u
- (get_local $$p$0)
- (i32.const 11)
- )
- (i32.eq
- (set_local $$sub74$i
- (i32.sub
- (i32.const 12)
- (get_local $$p$0)
- )
+ (if
+ (i32.or
+ (i32.gt_u
+ (get_local $$p$0)
+ (i32.const 11)
+ )
+ (i32.eq
+ (set_local $$sub74$i
+ (i32.sub
+ (i32.const 12)
+ (get_local $$p$0)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (set_local $$y$addr$1$i
- (get_local $$mul$i$240)
+ )
+ (set_local $$y$addr$1$i
+ (get_local $$mul$i$240)
+ )
+ (block
+ (set_local $$re$1482$i
+ (get_local $$sub74$i)
)
- (block
- (set_local $$re$1482$i
- (get_local $$sub74$i)
- )
- (set_local $$round$0481$i
- (f64.const 8)
+ (set_local $$round$0481$i
+ (f64.const 8)
+ )
+ (loop $while-out$60 $while-in$61
+ (set_local $$mul80$i
+ (f64.mul
+ (get_local $$round$0481$i)
+ (f64.const 16)
+ )
)
- (loop $while-out$60 $while-in$61
- (set_local $$mul80$i
- (f64.mul
- (get_local $$round$0481$i)
- (f64.const 16)
+ (if
+ (i32.eq
+ (set_local $$dec78$i
+ (i32.add
+ (get_local $$re$1482$i)
+ (i32.const -1)
+ )
)
+ (i32.const 0)
)
- (if
- (i32.eq
- (set_local $$dec78$i
- (i32.add
- (get_local $$re$1482$i)
- (i32.const -1)
- )
- )
- (i32.const 0)
+ (block
+ (set_local $$mul80$i$lcssa
+ (get_local $$mul80$i)
)
- (block
- (set_local $$mul80$i$lcssa
- (get_local $$mul80$i)
- )
- (br $while-out$60)
+ (br $while-out$60)
+ )
+ (block
+ (set_local $$re$1482$i
+ (get_local $$dec78$i)
)
- (block
- (set_local $$re$1482$i
- (get_local $$dec78$i)
- )
- (set_local $$round$0481$i
- (get_local $$mul80$i)
- )
+ (set_local $$round$0481$i
+ (get_local $$mul80$i)
)
)
- (br $while-in$61)
)
- (if
- (i32.eq
- (i32.shr_s
- (i32.shl
- (i32.load8_s
- (get_local $$prefix$0$add$ptr65$i)
- )
- (i32.const 24)
+ (br $while-in$61)
+ )
+ (if
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (i32.load8_s
+ (get_local $$prefix$0$add$ptr65$i)
)
(i32.const 24)
)
- (i32.const 45)
- )
- (block
- (set_local $$y$addr$1$i
- (f64.neg
- (f64.add
- (get_local $$mul80$i$lcssa)
- (f64.sub
- (f64.neg
- (get_local $$mul$i$240)
- )
- (get_local $$mul80$i$lcssa)
- )
- )
- )
- )
- (br $do-once$58)
+ (i32.const 24)
)
- (block
- (set_local $$y$addr$1$i
+ (i32.const 45)
+ )
+ (set_local $$y$addr$1$i
+ (f64.neg
+ (f64.add
+ (get_local $$mul80$i$lcssa)
(f64.sub
- (f64.add
+ (f64.neg
(get_local $$mul$i$240)
- (get_local $$mul80$i$lcssa)
)
(get_local $$mul80$i$lcssa)
)
)
- (br $do-once$58)
+ )
+ )
+ (set_local $$y$addr$1$i
+ (f64.sub
+ (f64.add
+ (get_local $$mul$i$240)
+ (get_local $$mul80$i$lcssa)
+ )
+ (get_local $$mul80$i$lcssa)
)
)
)
@@ -8280,7 +8264,6 @@
(set_local $$t$addr$1$i
(get_local $$t$addr$0$i)
)
- (br $do-once$98)
)
(block
(set_local $$$sub562$i
@@ -8320,7 +8303,6 @@
(set_local $$t$addr$1$i
(get_local $$t$addr$0$i)
)
- (br $do-once$98)
)
)
)
@@ -10926,7 +10908,6 @@
)
(br $label$break$L1)
)
- (br $label$break$L1)
)
)
)
@@ -11923,60 +11904,57 @@
)
)
)
- (block $do-once$2
- (if
- (i32.eq
- (get_local $$arrayidx)
- (get_local $$3)
- )
- (i32.store
- (i32.const 176)
- (i32.and
- (get_local $$0)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $$add8)
- )
- (i32.const -1)
+ (if
+ (i32.eq
+ (get_local $$arrayidx)
+ (get_local $$3)
+ )
+ (i32.store
+ (i32.const 176)
+ (i32.and
+ (get_local $$0)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $$add8)
)
+ (i32.const -1)
)
)
- (block
- (if
- (i32.lt_u
- (get_local $$3)
- (i32.load
- (i32.const 192)
- )
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $$3)
+ (i32.load
+ (i32.const 192)
)
- (call_import $_abort)
)
- (if
- (i32.eq
- (i32.load
- (set_local $$bk
- (i32.add
- (get_local $$3)
- (i32.const 12)
- )
+ (call_import $_abort)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $$bk
+ (i32.add
+ (get_local $$3)
+ (i32.const 12)
)
)
- (get_local $$2)
)
- (block
- (i32.store
- (get_local $$bk)
- (get_local $$arrayidx)
- )
- (i32.store
- (get_local $$1)
- (get_local $$3)
- )
- (br $do-once$2)
+ (get_local $$2)
+ )
+ (block
+ (i32.store
+ (get_local $$bk)
+ (get_local $$arrayidx)
+ )
+ (i32.store
+ (get_local $$1)
+ (get_local $$3)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
)
@@ -12182,70 +12160,67 @@
)
)
)
- (block $do-once$4
- (if
- (i32.eq
- (get_local $$arrayidx66)
- (get_local $$10)
- )
- (block
- (i32.store
- (i32.const 176)
- (i32.and
- (get_local $$0)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $$add64)
- )
- (i32.const -1)
+ (if
+ (i32.eq
+ (get_local $$arrayidx66)
+ (get_local $$10)
+ )
+ (block
+ (i32.store
+ (i32.const 176)
+ (i32.and
+ (get_local $$0)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $$add64)
)
+ (i32.const -1)
)
)
- (set_local $$13
- (get_local $$7)
- )
)
- (block
- (if
- (i32.lt_u
- (get_local $$10)
- (i32.load
- (i32.const 192)
- )
+ (set_local $$13
+ (get_local $$7)
+ )
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $$10)
+ (i32.load
+ (i32.const 192)
)
- (call_import $_abort)
)
- (if
- (i32.eq
- (i32.load
- (set_local $$bk78
- (i32.add
- (get_local $$10)
- (i32.const 12)
- )
+ (call_import $_abort)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $$bk78
+ (i32.add
+ (get_local $$10)
+ (i32.const 12)
)
)
- (get_local $$9)
)
- (block
- (i32.store
- (get_local $$bk78)
- (get_local $$arrayidx66)
- )
- (i32.store
- (get_local $$8)
- (get_local $$10)
- )
- (set_local $$13
- (i32.load
- (i32.const 184)
- )
+ (get_local $$9)
+ )
+ (block
+ (i32.store
+ (get_local $$bk78)
+ (get_local $$arrayidx66)
+ )
+ (i32.store
+ (get_local $$8)
+ (get_local $$10)
+ )
+ (set_local $$13
+ (i32.load
+ (i32.const 184)
)
- (br $do-once$4)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
)
@@ -12777,7 +12752,6 @@
(set_local $$R$3$i
(get_local $$R$1$i$lcssa)
)
- (br $do-once$8)
)
)
)
@@ -12833,7 +12807,6 @@
(set_local $$R$3$i
(get_local $$27)
)
- (br $do-once$8)
)
(call_import $_abort)
)
@@ -12952,34 +12925,31 @@
(get_local $$R$3$i)
(get_local $$26)
)
- (block $do-once$14
- (if
- (i32.eqz
- (i32.eq
- (set_local $$41
- (i32.load offset=16
- (get_local $$v$0$i$lcssa)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$41
+ (i32.load offset=16
+ (get_local $$v$0$i$lcssa)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$41)
+ (get_local $$40)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R$3$i)
(get_local $$41)
- (get_local $$40)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R$3$i)
- (get_local $$41)
- )
- (i32.store offset=24
- (get_local $$41)
- (get_local $$R$3$i)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $$41)
+ (get_local $$R$3$i)
)
)
)
@@ -13012,7 +12982,6 @@
(get_local $$42)
(get_local $$R$3$i)
)
- (br $do-once$12)
)
)
)
@@ -14050,7 +14019,6 @@
(set_local $$R$3$i$171
(get_local $$R$1$i$168$lcssa)
)
- (br $do-once$21)
)
)
)
@@ -14106,7 +14074,6 @@
(set_local $$R$3$i$171
(get_local $$64)
)
- (br $do-once$21)
)
(call_import $_abort)
)
@@ -14225,34 +14192,31 @@
(get_local $$R$3$i$171)
(get_local $$63)
)
- (block $do-once$27
- (if
- (i32.eqz
- (i32.eq
- (set_local $$78
- (i32.load offset=16
- (get_local $$v$4$lcssa$i)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$78
+ (i32.load offset=16
+ (get_local $$v$4$lcssa$i)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$78)
+ (get_local $$77)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R$3$i$171)
(get_local $$78)
- (get_local $$77)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R$3$i$171)
- (get_local $$78)
- )
- (i32.store offset=24
- (get_local $$78)
- (get_local $$R$3$i$171)
- )
- (br $do-once$27)
+ (i32.store offset=24
+ (get_local $$78)
+ (get_local $$R$3$i$171)
)
)
)
@@ -14285,7 +14249,6 @@
(get_local $$79)
(get_local $$R$3$i$171)
)
- (br $do-once$25)
)
)
)
@@ -14774,7 +14737,6 @@
(get_local $$add$ptr$i$161)
(get_local $$add$ptr$i$161)
)
- (br $do-once$29)
)
)
(if
@@ -14827,7 +14789,6 @@
(get_local $$add$ptr$i$161)
(i32.const 0)
)
- (br $do-once$29)
)
(call_import $_abort)
)
@@ -15017,70 +14978,67 @@
)
)
)
- (block $do-once$33
+ (if
+ (i32.eq
+ (i32.load
+ (i32.const 648)
+ )
+ (i32.const 0)
+ )
(if
(i32.eq
- (i32.load
- (i32.const 648)
- )
- (i32.const 0)
- )
- (if
- (i32.eq
- (i32.and
- (i32.add
- (set_local $$call$i$i
- (call_import $_sysconf
- (i32.const 30)
- )
+ (i32.and
+ (i32.add
+ (set_local $$call$i$i
+ (call_import $_sysconf
+ (i32.const 30)
)
- (i32.const -1)
)
- (get_local $$call$i$i)
+ (i32.const -1)
)
+ (get_local $$call$i$i)
+ )
+ (i32.const 0)
+ )
+ (block
+ (i32.store
+ (i32.const 656)
+ (get_local $$call$i$i)
+ )
+ (i32.store
+ (i32.const 652)
+ (get_local $$call$i$i)
+ )
+ (i32.store
+ (i32.const 660)
+ (i32.const -1)
+ )
+ (i32.store
+ (i32.const 664)
+ (i32.const -1)
+ )
+ (i32.store
+ (i32.const 668)
(i32.const 0)
)
- (block
- (i32.store
- (i32.const 656)
- (get_local $$call$i$i)
- )
- (i32.store
- (i32.const 652)
- (get_local $$call$i$i)
- )
- (i32.store
- (i32.const 660)
- (i32.const -1)
- )
- (i32.store
- (i32.const 664)
- (i32.const -1)
- )
- (i32.store
- (i32.const 668)
- (i32.const 0)
- )
- (i32.store
- (i32.const 620)
- (i32.const 0)
- )
- (i32.store
- (i32.const 648)
- (i32.xor
- (i32.and
- (call_import $_time
- (i32.const 0)
- )
- (i32.const -16)
+ (i32.store
+ (i32.const 620)
+ (i32.const 0)
+ )
+ (i32.store
+ (i32.const 648)
+ (i32.xor
+ (i32.and
+ (call_import $_time
+ (i32.const 0)
)
- (i32.const 1431655768)
+ (i32.const -16)
)
+ (i32.const 1431655768)
)
- (br $do-once$33)
)
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
(set_local $$add$i$180
@@ -15472,78 +15430,73 @@
(get_local $$ssize$2$ph$i)
)
)
- (block $do-once$42
- (if
+ (if
+ (i32.and
+ (i32.gt_u
+ (get_local $$add$i$180)
+ (get_local $$ssize$2$ph$i)
+ )
(i32.and
- (i32.gt_u
- (get_local $$add$i$180)
+ (i32.lt_u
(get_local $$ssize$2$ph$i)
+ (i32.const 2147483647)
)
- (i32.and
- (i32.lt_u
- (get_local $$ssize$2$ph$i)
- (i32.const 2147483647)
- )
- (i32.ne
- (get_local $$br$2$ph$i)
- (i32.const -1)
- )
+ (i32.ne
+ (get_local $$br$2$ph$i)
+ (i32.const -1)
)
)
- (if
- (i32.lt_u
- (set_local $$and104$i
- (i32.and
- (i32.add
- (i32.sub
- (get_local $$sub$i$181)
- (get_local $$ssize$2$ph$i)
- )
- (set_local $$115
- (i32.load
- (i32.const 656)
- )
- )
- )
+ )
+ (if
+ (i32.lt_u
+ (set_local $$and104$i
+ (i32.and
+ (i32.add
(i32.sub
- (i32.const 0)
- (get_local $$115)
+ (get_local $$sub$i$181)
+ (get_local $$ssize$2$ph$i)
+ )
+ (set_local $$115
+ (i32.load
+ (i32.const 656)
+ )
)
)
- )
- (i32.const 2147483647)
- )
- (if
- (i32.eq
- (call_import $_sbrk
- (get_local $$and104$i)
+ (i32.sub
+ (i32.const 0)
+ (get_local $$115)
)
- (i32.const -1)
)
- (block
- (call_import $_sbrk
- (get_local $$sub112$i)
- )
- (br $label$break$L279)
+ )
+ (i32.const 2147483647)
+ )
+ (if
+ (i32.eq
+ (call_import $_sbrk
+ (get_local $$and104$i)
)
- (block
- (set_local $$ssize$5$i
- (i32.add
- (get_local $$and104$i)
- (get_local $$ssize$2$ph$i)
- )
- )
- (br $do-once$42)
+ (i32.const -1)
+ )
+ (block
+ (call_import $_sbrk
+ (get_local $$sub112$i)
)
+ (br $label$break$L279)
)
(set_local $$ssize$5$i
- (get_local $$ssize$2$ph$i)
+ (i32.add
+ (get_local $$and104$i)
+ (get_local $$ssize$2$ph$i)
+ )
)
)
(set_local $$ssize$5$i
(get_local $$ssize$2$ph$i)
)
)
+ (set_local $$ssize$5$i
+ (get_local $$ssize$2$ph$i)
+ )
)
(if
(i32.eqz
@@ -16601,7 +16554,6 @@
(set_local $$R$3$i$i
(get_local $$R$1$i$i$lcssa)
)
- (br $do-once$59)
)
)
)
@@ -16657,7 +16609,6 @@
(set_local $$R$3$i$i
(get_local $$155)
)
- (br $do-once$59)
)
(call_import $_abort)
)
@@ -16775,39 +16726,36 @@
(get_local $$R$3$i$i)
(get_local $$154)
)
- (block $do-once$65
- (if
- (i32.eqz
- (i32.eq
- (set_local $$169
- (i32.load
- (set_local $$child166$i$i
- (i32.add
- (get_local $$add$ptr16$i$i)
- (i32.const 16)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$169
+ (i32.load
+ (set_local $$child166$i$i
+ (i32.add
+ (get_local $$add$ptr16$i$i)
+ (i32.const 16)
)
)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$169)
+ (get_local $$168)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R$3$i$i)
(get_local $$169)
- (get_local $$168)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R$3$i$i)
- (get_local $$169)
- )
- (i32.store offset=24
- (get_local $$169)
- (get_local $$R$3$i$i)
- )
- (br $do-once$65)
+ (i32.store offset=24
+ (get_local $$169)
+ (get_local $$R$3$i$i)
)
)
)
@@ -16839,7 +16787,6 @@
(get_local $$170)
(get_local $$R$3$i$i)
)
- (br $label$break$L331)
)
)
)
@@ -17330,7 +17277,6 @@
(get_local $$add$ptr17$i$i)
(get_local $$add$ptr17$i$i)
)
- (br $do-once$52)
)
)
(if
@@ -17383,7 +17329,6 @@
(get_local $$add$ptr17$i$i)
(i32.const 0)
)
- (br $do-once$52)
)
(call_import $_abort)
)
@@ -18108,7 +18053,6 @@
(get_local $$119)
(get_local $$119)
)
- (br $do-once$44)
)
)
(if
@@ -18161,7 +18105,6 @@
(get_local $$119)
(i32.const 0)
)
- (br $do-once$44)
)
(call_import $_abort)
)
@@ -18810,7 +18753,6 @@
(set_local $$R$3
(get_local $$R$1$lcssa)
)
- (br $do-once$2)
)
)
)
@@ -18866,7 +18808,6 @@
(set_local $$R$3
(get_local $$10)
)
- (br $do-once$2)
)
(call_import $_abort)
)
@@ -19005,39 +18946,36 @@
(get_local $$R$3)
(get_local $$9)
)
- (block $do-once$6
- (if
- (i32.eqz
- (i32.eq
- (set_local $$24
- (i32.load
- (set_local $$child171
- (i32.add
- (get_local $$add$ptr16)
- (i32.const 16)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$24
+ (i32.load
+ (set_local $$child171
+ (i32.add
+ (get_local $$add$ptr16)
+ (i32.const 16)
)
)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$24)
+ (get_local $$23)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R$3)
(get_local $$24)
- (get_local $$23)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R$3)
- (get_local $$24)
- )
- (i32.store offset=24
- (get_local $$24)
- (get_local $$R$3)
- )
- (br $do-once$6)
+ (i32.store offset=24
+ (get_local $$24)
+ (get_local $$R$3)
)
)
)
@@ -19082,7 +19020,6 @@
(set_local $$psize$1
(get_local $$add17)
)
- (br $do-once$0)
)
)
)
@@ -19519,7 +19456,6 @@
(set_local $$R332$3
(get_local $$R332$1$lcssa)
)
- (br $do-once$10)
)
)
)
@@ -19577,7 +19513,6 @@
(set_local $$R332$3
(get_local $$42)
)
- (br $do-once$10)
)
(call_import $_abort)
)
@@ -19695,39 +19630,36 @@
(get_local $$R332$3)
(get_local $$41)
)
- (block $do-once$14
- (if
- (i32.eqz
- (i32.eq
- (set_local $$58
- (i32.load
- (set_local $$child443
- (i32.add
- (get_local $$add$ptr6)
- (i32.const 16)
- )
+ (if
+ (i32.eqz
+ (i32.eq
+ (set_local $$58
+ (i32.load
+ (set_local $$child443
+ (i32.add
+ (get_local $$add$ptr6)
+ (i32.const 16)
)
)
)
- (i32.const 0)
)
+ (i32.const 0)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $$58)
+ (get_local $$57)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store offset=16
+ (get_local $$R332$3)
(get_local $$58)
- (get_local $$57)
)
- (call_import $_abort)
- (block
- (i32.store offset=16
- (get_local $$R332$3)
- (get_local $$58)
- )
- (i32.store offset=24
- (get_local $$58)
- (get_local $$R332$3)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $$58)
+ (get_local $$R332$3)
)
)
)
@@ -19760,7 +19692,6 @@
(get_local $$59)
(get_local $$R332$3)
)
- (br $do-once$8)
)
)
)
@@ -20064,243 +19995,239 @@
(get_local $$p$1)
(i32.const 0)
)
- (block $do-once$16
- (if
- (i32.eq
- (i32.and
- (set_local $$66
- (i32.load
- (i32.const 180)
- )
- )
- (set_local $$shl573
- (i32.shl
- (i32.const 1)
- (get_local $$I534$0)
- )
+ (if
+ (i32.eq
+ (i32.and
+ (set_local $$66
+ (i32.load
+ (i32.const 180)
)
)
- (i32.const 0)
- )
- (block
- (i32.store
- (i32.const 180)
- (i32.or
- (get_local $$66)
- (get_local $$shl573)
+ (set_local $$shl573
+ (i32.shl
+ (i32.const 1)
+ (get_local $$I534$0)
)
)
- (i32.store
- (get_local $$arrayidx567)
- (get_local $$p$1)
+ )
+ (i32.const 0)
+ )
+ (block
+ (i32.store
+ (i32.const 180)
+ (i32.or
+ (get_local $$66)
+ (get_local $$shl573)
)
- (i32.store offset=24
- (get_local $$p$1)
+ )
+ (i32.store
+ (get_local $$arrayidx567)
+ (get_local $$p$1)
+ )
+ (i32.store offset=24
+ (get_local $$p$1)
+ (get_local $$arrayidx567)
+ )
+ (i32.store offset=12
+ (get_local $$p$1)
+ (get_local $$p$1)
+ )
+ (i32.store offset=8
+ (get_local $$p$1)
+ (get_local $$p$1)
+ )
+ )
+ (block
+ (set_local $$67
+ (i32.load
(get_local $$arrayidx567)
)
- (i32.store offset=12
- (get_local $$p$1)
- (get_local $$p$1)
- )
- (i32.store offset=8
- (get_local $$p$1)
- (get_local $$p$1)
+ )
+ (set_local $$sub589
+ (i32.sub
+ (i32.const 25)
+ (i32.shr_u
+ (get_local $$I534$0)
+ (i32.const 1)
+ )
)
)
- (block
- (set_local $$67
- (i32.load
- (get_local $$arrayidx567)
+ (set_local $$cond
+ (if
+ (i32.eq
+ (get_local $$I534$0)
+ (i32.const 31)
)
+ (i32.const 0)
+ (get_local $$sub589)
)
- (set_local $$sub589
- (i32.sub
- (i32.const 25)
- (i32.shr_u
- (get_local $$I534$0)
- (i32.const 1)
+ )
+ (set_local $$K583$0
+ (i32.shl
+ (get_local $$psize$2)
+ (get_local $$cond)
+ )
+ )
+ (set_local $$T$0
+ (get_local $$67)
+ )
+ (loop $while-out$18 $while-in$19
+ (if
+ (i32.eq
+ (i32.and
+ (i32.load offset=4
+ (get_local $$T$0)
+ )
+ (i32.const -8)
)
+ (get_local $$psize$2)
)
- )
- (set_local $$cond
- (if
- (i32.eq
- (get_local $$I534$0)
- (i32.const 31)
+ (block
+ (set_local $$T$0$lcssa
+ (get_local $$T$0)
)
- (i32.const 0)
- (get_local $$sub589)
+ (set_local $label
+ (i32.const 130)
+ )
+ (br $while-out$18)
)
)
- (set_local $$K583$0
+ (set_local $$shl600
(i32.shl
- (get_local $$psize$2)
- (get_local $$cond)
+ (get_local $$K583$0)
+ (i32.const 1)
)
)
- (set_local $$T$0
- (get_local $$67)
- )
- (loop $while-out$18 $while-in$19
- (if
- (i32.eq
- (i32.and
- (i32.load offset=4
- (get_local $$T$0)
+ (if
+ (i32.eq
+ (set_local $$69
+ (i32.load
+ (set_local $$arrayidx599
+ (i32.add
+ (i32.add
+ (get_local $$T$0)
+ (i32.const 16)
+ )
+ (i32.shl
+ (i32.shr_u
+ (get_local $$K583$0)
+ (i32.const 31)
+ )
+ (i32.const 2)
+ )
+ )
)
- (i32.const -8)
)
- (get_local $$psize$2)
)
- (block
- (set_local $$T$0$lcssa
- (get_local $$T$0)
- )
- (set_local $label
- (i32.const 130)
- )
- (br $while-out$18)
+ (i32.const 0)
+ )
+ (block
+ (set_local $$T$0$lcssa319
+ (get_local $$T$0)
)
+ (set_local $$arrayidx599$lcssa
+ (get_local $$arrayidx599)
+ )
+ (set_local $label
+ (i32.const 127)
+ )
+ (br $while-out$18)
)
- (set_local $$shl600
- (i32.shl
- (get_local $$K583$0)
- (i32.const 1)
+ (block
+ (set_local $$K583$0
+ (get_local $$shl600)
+ )
+ (set_local $$T$0
+ (get_local $$69)
)
)
- (if
- (i32.eq
- (set_local $$69
- (i32.load
- (set_local $$arrayidx599
- (i32.add
- (i32.add
- (get_local $$T$0)
- (i32.const 16)
- )
- (i32.shl
- (i32.shr_u
- (get_local $$K583$0)
- (i32.const 31)
- )
- (i32.const 2)
- )
- )
- )
- )
- )
- (i32.const 0)
+ )
+ (br $while-in$19)
+ )
+ (if
+ (i32.eq
+ (get_local $label)
+ (i32.const 127)
+ )
+ (if
+ (i32.lt_u
+ (get_local $$arrayidx599$lcssa)
+ (i32.load
+ (i32.const 192)
)
- (block
- (set_local $$T$0$lcssa319
- (get_local $$T$0)
- )
- (set_local $$arrayidx599$lcssa
- (get_local $$arrayidx599)
- )
- (set_local $label
- (i32.const 127)
- )
- (br $while-out$18)
+ )
+ (call_import $_abort)
+ (block
+ (i32.store
+ (get_local $$arrayidx599$lcssa)
+ (get_local $$p$1)
)
- (block
- (set_local $$K583$0
- (get_local $$shl600)
- )
- (set_local $$T$0
- (get_local $$69)
- )
+ (i32.store offset=24
+ (get_local $$p$1)
+ (get_local $$T$0$lcssa319)
+ )
+ (i32.store offset=12
+ (get_local $$p$1)
+ (get_local $$p$1)
+ )
+ (i32.store offset=8
+ (get_local $$p$1)
+ (get_local $$p$1)
)
)
- (br $while-in$19)
)
(if
(i32.eq
(get_local $label)
- (i32.const 127)
+ (i32.const 130)
)
(if
- (i32.lt_u
- (get_local $$arrayidx599$lcssa)
- (i32.load
- (i32.const 192)
+ (i32.and
+ (i32.ge_u
+ (set_local $$71
+ (i32.load
+ (set_local $$fd620
+ (i32.add
+ (get_local $$T$0$lcssa)
+ (i32.const 8)
+ )
+ )
+ )
+ )
+ (set_local $$72
+ (i32.load
+ (i32.const 192)
+ )
+ )
+ )
+ (i32.ge_u
+ (get_local $$T$0$lcssa)
+ (get_local $$72)
)
)
- (call_import $_abort)
(block
+ (i32.store offset=12
+ (get_local $$71)
+ (get_local $$p$1)
+ )
(i32.store
- (get_local $$arrayidx599$lcssa)
+ (get_local $$fd620)
(get_local $$p$1)
)
- (i32.store offset=24
+ (i32.store offset=8
(get_local $$p$1)
- (get_local $$T$0$lcssa319)
+ (get_local $$71)
)
(i32.store offset=12
(get_local $$p$1)
- (get_local $$p$1)
+ (get_local $$T$0$lcssa)
)
- (i32.store offset=8
- (get_local $$p$1)
+ (i32.store offset=24
(get_local $$p$1)
+ (i32.const 0)
)
- (br $do-once$16)
- )
- )
- (if
- (i32.eq
- (get_local $label)
- (i32.const 130)
- )
- (if
- (i32.and
- (i32.ge_u
- (set_local $$71
- (i32.load
- (set_local $$fd620
- (i32.add
- (get_local $$T$0$lcssa)
- (i32.const 8)
- )
- )
- )
- )
- (set_local $$72
- (i32.load
- (i32.const 192)
- )
- )
- )
- (i32.ge_u
- (get_local $$T$0$lcssa)
- (get_local $$72)
- )
- )
- (block
- (i32.store offset=12
- (get_local $$71)
- (get_local $$p$1)
- )
- (i32.store
- (get_local $$fd620)
- (get_local $$p$1)
- )
- (i32.store offset=8
- (get_local $$p$1)
- (get_local $$71)
- )
- (i32.store offset=12
- (get_local $$p$1)
- (get_local $$T$0$lcssa)
- )
- (i32.store offset=24
- (get_local $$p$1)
- (i32.const 0)
- )
- (br $do-once$16)
- )
- (call_import $_abort)
)
+ (call_import $_abort)
)
)
)
diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm
index dac188a60..e2bb3354e 100644
--- a/test/memorygrowth.fromasm
+++ b/test/memorygrowth.fromasm
@@ -234,60 +234,57 @@
)
)
)
- (block $do-once$2
- (if
- (i32.eq
- (get_local $i)
- (get_local $n)
- )
- (i32.store
- (i32.const 1208)
- (i32.and
- (get_local $f)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $h)
- )
- (i32.const -1)
+ (if
+ (i32.eq
+ (get_local $i)
+ (get_local $n)
+ )
+ (i32.store
+ (i32.const 1208)
+ (i32.and
+ (get_local $f)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $h)
)
+ (i32.const -1)
)
)
- (block
- (if
- (i32.lt_u
- (get_local $n)
- (i32.load
- (i32.const 1224)
- )
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $n)
+ (i32.load
+ (i32.const 1224)
)
- (call_import $qa)
)
- (if
- (i32.eq
- (i32.load
- (set_local $o
- (i32.add
- (get_local $n)
- (i32.const 12)
- )
+ (call_import $qa)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $o
+ (i32.add
+ (get_local $n)
+ (i32.const 12)
)
)
- (get_local $l)
)
- (block
- (i32.store
- (get_local $o)
- (get_local $i)
- )
- (i32.store
- (get_local $j)
- (get_local $n)
- )
- (br $do-once$2)
+ (get_local $l)
+ )
+ (block
+ (i32.store
+ (get_local $o)
+ (get_local $i)
+ )
+ (i32.store
+ (get_local $j)
+ (get_local $n)
)
- (call_import $qa)
)
+ (call_import $qa)
)
)
)
@@ -483,70 +480,67 @@
)
)
)
- (block $do-once$4
- (if
- (i32.eq
- (get_local $s)
- (get_local $i)
- )
- (block
- (i32.store
- (i32.const 1208)
- (i32.and
- (get_local $f)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $u)
- )
- (i32.const -1)
+ (if
+ (i32.eq
+ (get_local $s)
+ (get_local $i)
+ )
+ (block
+ (i32.store
+ (i32.const 1208)
+ (i32.and
+ (get_local $f)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $u)
)
+ (i32.const -1)
)
)
- (set_local $v
- (get_local $j)
- )
)
- (block
- (if
- (i32.lt_u
- (get_local $i)
- (i32.load
- (i32.const 1224)
- )
+ (set_local $v
+ (get_local $j)
+ )
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $i)
+ (i32.load
+ (i32.const 1224)
)
- (call_import $qa)
)
- (if
- (i32.eq
- (i32.load
- (set_local $n
- (i32.add
- (get_local $i)
- (i32.const 12)
- )
+ (call_import $qa)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $n
+ (i32.add
+ (get_local $i)
+ (i32.const 12)
)
)
- (get_local $q)
)
- (block
- (i32.store
- (get_local $n)
- (get_local $s)
- )
- (i32.store
- (get_local $t)
- (get_local $i)
- )
- (set_local $v
- (i32.load
- (i32.const 1216)
- )
+ (get_local $q)
+ )
+ (block
+ (i32.store
+ (get_local $n)
+ (get_local $s)
+ )
+ (i32.store
+ (get_local $t)
+ (get_local $i)
+ )
+ (set_local $v
+ (i32.load
+ (i32.const 1216)
)
- (br $do-once$4)
)
- (call_import $qa)
)
+ (call_import $qa)
)
)
)
@@ -1043,7 +1037,6 @@
(set_local $C
(get_local $F)
)
- (br $do-once$8)
)
)
)
@@ -1097,7 +1090,6 @@
(set_local $C
(get_local $o)
)
- (br $do-once$8)
)
(call_import $qa)
)
@@ -1209,29 +1201,26 @@
(get_local $C)
(get_local $e)
)
- (block $do-once$14
+ (if
+ (set_local $s
+ (i32.load offset=16
+ (get_local $A)
+ )
+ )
(if
- (set_local $s
- (i32.load offset=16
- (get_local $A)
- )
+ (i32.lt_u
+ (get_local $s)
+ (get_local $o)
)
- (if
- (i32.lt_u
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $C)
(get_local $s)
- (get_local $o)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $C)
- (get_local $s)
- )
- (i32.store offset=24
- (get_local $s)
- (get_local $C)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $s)
+ (get_local $C)
)
)
)
@@ -1259,7 +1248,6 @@
(get_local $s)
(get_local $C)
)
- (br $do-once$12)
)
)
)
@@ -2230,7 +2218,6 @@
(set_local $W
(get_local $Z)
)
- (br $do-once$21)
)
)
)
@@ -2284,7 +2271,6 @@
(set_local $W
(get_local $s)
)
- (br $do-once$21)
)
(call_import $qa)
)
@@ -2396,29 +2382,26 @@
(get_local $W)
(get_local $g)
)
- (block $do-once$27
+ (if
+ (set_local $q
+ (i32.load offset=16
+ (get_local $V)
+ )
+ )
(if
- (set_local $q
- (i32.load offset=16
- (get_local $V)
- )
+ (i32.lt_u
+ (get_local $q)
+ (get_local $s)
)
- (if
- (i32.lt_u
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $W)
(get_local $q)
- (get_local $s)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $W)
- (get_local $q)
- )
- (i32.store offset=24
- (get_local $q)
- (get_local $W)
- )
- (br $do-once$27)
+ (i32.store offset=24
+ (get_local $q)
+ (get_local $W)
)
)
)
@@ -2446,7 +2429,6 @@
(get_local $q)
(get_local $W)
)
- (br $do-once$25)
)
)
)
@@ -2905,7 +2887,6 @@
(get_local $i)
(get_local $i)
)
- (br $do-once$29)
)
)
(if
@@ -2958,7 +2939,6 @@
(get_local $i)
(i32.const 0)
)
- (br $do-once$29)
)
(call_import $qa)
)
@@ -3583,78 +3563,73 @@
(get_local $ka)
)
)
- (block $do-once$40
- (if
+ (if
+ (i32.and
+ (i32.gt_u
+ (get_local $ea)
+ (get_local $ka)
+ )
(i32.and
- (i32.gt_u
- (get_local $ea)
+ (i32.lt_u
(get_local $ka)
+ (i32.const 2147483647)
)
- (i32.and
- (i32.lt_u
- (get_local $ka)
- (i32.const 2147483647)
- )
- (i32.ne
- (get_local $ja)
- (i32.const -1)
- )
+ (i32.ne
+ (get_local $ja)
+ (i32.const -1)
)
)
- (if
- (i32.lt_u
- (set_local $e
- (i32.and
- (i32.add
- (i32.sub
- (get_local $ca)
- (get_local $ka)
- )
- (set_local $U
- (i32.load
- (i32.const 1688)
- )
- )
- )
+ )
+ (if
+ (i32.lt_u
+ (set_local $e
+ (i32.and
+ (i32.add
(i32.sub
- (i32.const 0)
- (get_local $U)
+ (get_local $ca)
+ (get_local $ka)
+ )
+ (set_local $U
+ (i32.load
+ (i32.const 1688)
+ )
)
)
- )
- (i32.const 2147483647)
- )
- (if
- (i32.eq
- (call_import $ta
- (get_local $e)
+ (i32.sub
+ (i32.const 0)
+ (get_local $U)
)
- (i32.const -1)
)
- (block
- (call_import $ta
- (get_local $$)
- )
- (br $label$break$d)
+ )
+ (i32.const 2147483647)
+ )
+ (if
+ (i32.eq
+ (call_import $ta
+ (get_local $e)
)
- (block
- (set_local $ma
- (i32.add
- (get_local $e)
- (get_local $ka)
- )
- )
- (br $do-once$40)
+ (i32.const -1)
+ )
+ (block
+ (call_import $ta
+ (get_local $$)
)
+ (br $label$break$d)
)
(set_local $ma
- (get_local $ka)
+ (i32.add
+ (get_local $e)
+ (get_local $ka)
+ )
)
)
(set_local $ma
(get_local $ka)
)
)
+ (set_local $ma
+ (get_local $ka)
+ )
)
(if
(i32.ne
@@ -4487,7 +4462,6 @@
(set_local $ya
(get_local $Ba)
)
- (br $do-once$57)
)
)
)
@@ -4541,7 +4515,6 @@
(set_local $ya
(get_local $e)
)
- (br $do-once$57)
)
(call_import $qa)
)
@@ -4652,34 +4625,31 @@
(get_local $ya)
(get_local $$)
)
- (block $do-once$63
- (if
- (set_local $V
- (i32.load
- (set_local $da
- (i32.add
- (get_local $ma)
- (i32.const 16)
- )
+ (if
+ (set_local $V
+ (i32.load
+ (set_local $da
+ (i32.add
+ (get_local $ma)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $V)
+ (get_local $e)
+ )
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $ya)
(get_local $V)
- (get_local $e)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $ya)
- (get_local $V)
- )
- (i32.store offset=24
- (get_local $V)
- (get_local $ya)
- )
- (br $do-once$63)
+ (i32.store offset=24
+ (get_local $V)
+ (get_local $ya)
)
)
)
@@ -4710,7 +4680,6 @@
(get_local $V)
(get_local $ya)
)
- (br $label$break$e)
)
)
)
@@ -5171,7 +5140,6 @@
(get_local $ka)
(get_local $ka)
)
- (br $do-once$50)
)
)
(if
@@ -5224,7 +5192,6 @@
(get_local $ka)
(i32.const 0)
)
- (br $do-once$50)
)
(call_import $qa)
)
@@ -5894,7 +5861,6 @@
(get_local $ja)
(get_local $ja)
)
- (br $do-once$42)
)
)
(if
@@ -5947,7 +5913,6 @@
(get_local $ja)
(i32.const 0)
)
- (br $do-once$42)
)
(call_import $qa)
)
@@ -6645,7 +6610,6 @@
(set_local $s
(get_local $v)
)
- (br $do-once$2)
)
)
)
@@ -6699,7 +6663,6 @@
(set_local $s
(get_local $j)
)
- (br $do-once$2)
)
(call_import $qa)
)
@@ -6825,34 +6788,31 @@
(get_local $s)
(get_local $g)
)
- (block $do-once$6
- (if
- (set_local $o
- (i32.load
- (set_local $l
- (i32.add
- (get_local $h)
- (i32.const 16)
- )
+ (if
+ (set_local $o
+ (i32.load
+ (set_local $l
+ (i32.add
+ (get_local $h)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $o)
+ (get_local $j)
+ )
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $s)
(get_local $o)
- (get_local $j)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $s)
- (get_local $o)
- )
- (i32.store offset=24
- (get_local $o)
- (get_local $s)
- )
- (br $do-once$6)
+ (i32.store offset=24
+ (get_local $o)
+ (get_local $s)
)
)
)
@@ -6886,7 +6846,6 @@
(set_local $n
(get_local $i)
)
- (br $do-once$0)
)
)
(block
@@ -7331,7 +7290,6 @@
(set_local $y
(get_local $B)
)
- (br $do-once$10)
)
)
)
@@ -7387,7 +7345,6 @@
(set_local $y
(get_local $w)
)
- (br $do-once$10)
)
(call_import $qa)
)
@@ -7498,34 +7455,31 @@
(get_local $y)
(get_local $v)
)
- (block $do-once$14
- (if
- (set_local $h
- (i32.load
- (set_local $i
- (i32.add
- (get_local $f)
- (i32.const 16)
- )
+ (if
+ (set_local $h
+ (i32.load
+ (set_local $i
+ (i32.add
+ (get_local $f)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $h)
+ (get_local $w)
+ )
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $y)
(get_local $h)
- (get_local $w)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $y)
- (get_local $h)
- )
- (i32.store offset=24
- (get_local $h)
- (get_local $y)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $h)
+ (get_local $y)
)
)
)
@@ -7553,7 +7507,6 @@
(get_local $h)
(get_local $y)
)
- (br $do-once$8)
)
)
)
@@ -7820,228 +7773,224 @@
(get_local $m)
(i32.const 0)
)
- (block $do-once$16
- (if
- (i32.and
- (set_local $E
- (i32.load
- (i32.const 1212)
- )
+ (if
+ (i32.and
+ (set_local $E
+ (i32.load
+ (i32.const 1212)
)
- (set_local $e
- (i32.shl
- (i32.const 1)
- (get_local $G)
- )
+ )
+ (set_local $e
+ (i32.shl
+ (i32.const 1)
+ (get_local $G)
)
)
- (block
- (set_local $F
- (i32.shl
- (get_local $D)
- (if
- (i32.eq
+ )
+ (block
+ (set_local $F
+ (i32.shl
+ (get_local $D)
+ (if
+ (i32.eq
+ (get_local $G)
+ (i32.const 31)
+ )
+ (i32.const 0)
+ (i32.sub
+ (i32.const 25)
+ (i32.shr_u
(get_local $G)
- (i32.const 31)
- )
- (i32.const 0)
- (i32.sub
- (i32.const 25)
- (i32.shr_u
- (get_local $G)
- (i32.const 1)
- )
+ (i32.const 1)
)
)
)
)
- (set_local $b
- (i32.load
- (get_local $s)
- )
+ )
+ (set_local $b
+ (i32.load
+ (get_local $s)
)
- (loop $while-out$18 $while-in$19
- (if
- (i32.eq
- (i32.and
- (i32.load offset=4
- (get_local $b)
- )
- (i32.const -8)
- )
- (get_local $D)
- )
- (block
- (set_local $H
+ )
+ (loop $while-out$18 $while-in$19
+ (if
+ (i32.eq
+ (i32.and
+ (i32.load offset=4
(get_local $b)
)
- (set_local $I
- (i32.const 130)
- )
- (br $while-out$18)
+ (i32.const -8)
)
+ (get_local $D)
)
- (if
- (set_local $y
- (i32.load
- (set_local $n
+ (block
+ (set_local $H
+ (get_local $b)
+ )
+ (set_local $I
+ (i32.const 130)
+ )
+ (br $while-out$18)
+ )
+ )
+ (if
+ (set_local $y
+ (i32.load
+ (set_local $n
+ (i32.add
(i32.add
- (i32.add
- (get_local $b)
- (i32.const 16)
- )
- (i32.shl
- (i32.shr_u
- (get_local $F)
- (i32.const 31)
- )
- (i32.const 2)
+ (get_local $b)
+ (i32.const 16)
+ )
+ (i32.shl
+ (i32.shr_u
+ (get_local $F)
+ (i32.const 31)
)
+ (i32.const 2)
)
)
)
)
- (block
- (set_local $F
- (i32.shl
- (get_local $F)
- (i32.const 1)
- )
- )
- (set_local $b
- (get_local $y)
+ )
+ (block
+ (set_local $F
+ (i32.shl
+ (get_local $F)
+ (i32.const 1)
)
)
- (block
- (set_local $J
- (get_local $n)
- )
- (set_local $K
- (get_local $b)
- )
- (set_local $I
- (i32.const 127)
- )
- (br $while-out$18)
+ (set_local $b
+ (get_local $y)
+ )
+ )
+ (block
+ (set_local $J
+ (get_local $n)
+ )
+ (set_local $K
+ (get_local $b)
+ )
+ (set_local $I
+ (i32.const 127)
+ )
+ (br $while-out$18)
+ )
+ )
+ (br $while-in$19)
+ )
+ (if
+ (i32.eq
+ (get_local $I)
+ (i32.const 127)
+ )
+ (if
+ (i32.lt_u
+ (get_local $J)
+ (i32.load
+ (i32.const 1224)
+ )
+ )
+ (call_import $qa)
+ (block
+ (i32.store
+ (get_local $J)
+ (get_local $m)
+ )
+ (i32.store offset=24
+ (get_local $m)
+ (get_local $K)
+ )
+ (i32.store offset=12
+ (get_local $m)
+ (get_local $m)
+ )
+ (i32.store offset=8
+ (get_local $m)
+ (get_local $m)
)
)
- (br $while-in$19)
)
(if
(i32.eq
(get_local $I)
- (i32.const 127)
+ (i32.const 130)
)
(if
- (i32.lt_u
- (get_local $J)
- (i32.load
- (i32.const 1224)
+ (i32.and
+ (i32.ge_u
+ (set_local $F
+ (i32.load
+ (set_local $b
+ (i32.add
+ (get_local $H)
+ (i32.const 8)
+ )
+ )
+ )
+ )
+ (set_local $i
+ (i32.load
+ (i32.const 1224)
+ )
+ )
+ )
+ (i32.ge_u
+ (get_local $H)
+ (get_local $i)
)
)
- (call_import $qa)
(block
+ (i32.store offset=12
+ (get_local $F)
+ (get_local $m)
+ )
(i32.store
- (get_local $J)
+ (get_local $b)
(get_local $m)
)
- (i32.store offset=24
+ (i32.store offset=8
(get_local $m)
- (get_local $K)
+ (get_local $F)
)
(i32.store offset=12
(get_local $m)
- (get_local $m)
+ (get_local $H)
)
- (i32.store offset=8
- (get_local $m)
+ (i32.store offset=24
(get_local $m)
+ (i32.const 0)
)
- (br $do-once$16)
- )
- )
- (if
- (i32.eq
- (get_local $I)
- (i32.const 130)
- )
- (if
- (i32.and
- (i32.ge_u
- (set_local $F
- (i32.load
- (set_local $b
- (i32.add
- (get_local $H)
- (i32.const 8)
- )
- )
- )
- )
- (set_local $i
- (i32.load
- (i32.const 1224)
- )
- )
- )
- (i32.ge_u
- (get_local $H)
- (get_local $i)
- )
- )
- (block
- (i32.store offset=12
- (get_local $F)
- (get_local $m)
- )
- (i32.store
- (get_local $b)
- (get_local $m)
- )
- (i32.store offset=8
- (get_local $m)
- (get_local $F)
- )
- (i32.store offset=12
- (get_local $m)
- (get_local $H)
- )
- (i32.store offset=24
- (get_local $m)
- (i32.const 0)
- )
- (br $do-once$16)
- )
- (call_import $qa)
)
+ (call_import $qa)
)
)
)
- (block
- (i32.store
- (i32.const 1212)
- (i32.or
- (get_local $E)
- (get_local $e)
- )
- )
- (i32.store
- (get_local $s)
- (get_local $m)
- )
- (i32.store offset=24
- (get_local $m)
- (get_local $s)
- )
- (i32.store offset=12
- (get_local $m)
- (get_local $m)
- )
- (i32.store offset=8
- (get_local $m)
- (get_local $m)
+ )
+ (block
+ (i32.store
+ (i32.const 1212)
+ (i32.or
+ (get_local $E)
+ (get_local $e)
)
)
+ (i32.store
+ (get_local $s)
+ (get_local $m)
+ )
+ (i32.store offset=24
+ (get_local $m)
+ (get_local $s)
+ )
+ (i32.store offset=12
+ (get_local $m)
+ (get_local $m)
+ )
+ (i32.store offset=8
+ (get_local $m)
+ (get_local $m)
+ )
)
)
(i32.store
diff --git a/test/memorygrowth.fromasm.imprecise b/test/memorygrowth.fromasm.imprecise
index dac188a60..e2bb3354e 100644
--- a/test/memorygrowth.fromasm.imprecise
+++ b/test/memorygrowth.fromasm.imprecise
@@ -234,60 +234,57 @@
)
)
)
- (block $do-once$2
- (if
- (i32.eq
- (get_local $i)
- (get_local $n)
- )
- (i32.store
- (i32.const 1208)
- (i32.and
- (get_local $f)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $h)
- )
- (i32.const -1)
+ (if
+ (i32.eq
+ (get_local $i)
+ (get_local $n)
+ )
+ (i32.store
+ (i32.const 1208)
+ (i32.and
+ (get_local $f)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $h)
)
+ (i32.const -1)
)
)
- (block
- (if
- (i32.lt_u
- (get_local $n)
- (i32.load
- (i32.const 1224)
- )
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $n)
+ (i32.load
+ (i32.const 1224)
)
- (call_import $qa)
)
- (if
- (i32.eq
- (i32.load
- (set_local $o
- (i32.add
- (get_local $n)
- (i32.const 12)
- )
+ (call_import $qa)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $o
+ (i32.add
+ (get_local $n)
+ (i32.const 12)
)
)
- (get_local $l)
)
- (block
- (i32.store
- (get_local $o)
- (get_local $i)
- )
- (i32.store
- (get_local $j)
- (get_local $n)
- )
- (br $do-once$2)
+ (get_local $l)
+ )
+ (block
+ (i32.store
+ (get_local $o)
+ (get_local $i)
+ )
+ (i32.store
+ (get_local $j)
+ (get_local $n)
)
- (call_import $qa)
)
+ (call_import $qa)
)
)
)
@@ -483,70 +480,67 @@
)
)
)
- (block $do-once$4
- (if
- (i32.eq
- (get_local $s)
- (get_local $i)
- )
- (block
- (i32.store
- (i32.const 1208)
- (i32.and
- (get_local $f)
- (i32.xor
- (i32.shl
- (i32.const 1)
- (get_local $u)
- )
- (i32.const -1)
+ (if
+ (i32.eq
+ (get_local $s)
+ (get_local $i)
+ )
+ (block
+ (i32.store
+ (i32.const 1208)
+ (i32.and
+ (get_local $f)
+ (i32.xor
+ (i32.shl
+ (i32.const 1)
+ (get_local $u)
)
+ (i32.const -1)
)
)
- (set_local $v
- (get_local $j)
- )
)
- (block
- (if
- (i32.lt_u
- (get_local $i)
- (i32.load
- (i32.const 1224)
- )
+ (set_local $v
+ (get_local $j)
+ )
+ )
+ (block
+ (if
+ (i32.lt_u
+ (get_local $i)
+ (i32.load
+ (i32.const 1224)
)
- (call_import $qa)
)
- (if
- (i32.eq
- (i32.load
- (set_local $n
- (i32.add
- (get_local $i)
- (i32.const 12)
- )
+ (call_import $qa)
+ )
+ (if
+ (i32.eq
+ (i32.load
+ (set_local $n
+ (i32.add
+ (get_local $i)
+ (i32.const 12)
)
)
- (get_local $q)
)
- (block
- (i32.store
- (get_local $n)
- (get_local $s)
- )
- (i32.store
- (get_local $t)
- (get_local $i)
- )
- (set_local $v
- (i32.load
- (i32.const 1216)
- )
+ (get_local $q)
+ )
+ (block
+ (i32.store
+ (get_local $n)
+ (get_local $s)
+ )
+ (i32.store
+ (get_local $t)
+ (get_local $i)
+ )
+ (set_local $v
+ (i32.load
+ (i32.const 1216)
)
- (br $do-once$4)
)
- (call_import $qa)
)
+ (call_import $qa)
)
)
)
@@ -1043,7 +1037,6 @@
(set_local $C
(get_local $F)
)
- (br $do-once$8)
)
)
)
@@ -1097,7 +1090,6 @@
(set_local $C
(get_local $o)
)
- (br $do-once$8)
)
(call_import $qa)
)
@@ -1209,29 +1201,26 @@
(get_local $C)
(get_local $e)
)
- (block $do-once$14
+ (if
+ (set_local $s
+ (i32.load offset=16
+ (get_local $A)
+ )
+ )
(if
- (set_local $s
- (i32.load offset=16
- (get_local $A)
- )
+ (i32.lt_u
+ (get_local $s)
+ (get_local $o)
)
- (if
- (i32.lt_u
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $C)
(get_local $s)
- (get_local $o)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $C)
- (get_local $s)
- )
- (i32.store offset=24
- (get_local $s)
- (get_local $C)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $s)
+ (get_local $C)
)
)
)
@@ -1259,7 +1248,6 @@
(get_local $s)
(get_local $C)
)
- (br $do-once$12)
)
)
)
@@ -2230,7 +2218,6 @@
(set_local $W
(get_local $Z)
)
- (br $do-once$21)
)
)
)
@@ -2284,7 +2271,6 @@
(set_local $W
(get_local $s)
)
- (br $do-once$21)
)
(call_import $qa)
)
@@ -2396,29 +2382,26 @@
(get_local $W)
(get_local $g)
)
- (block $do-once$27
+ (if
+ (set_local $q
+ (i32.load offset=16
+ (get_local $V)
+ )
+ )
(if
- (set_local $q
- (i32.load offset=16
- (get_local $V)
- )
+ (i32.lt_u
+ (get_local $q)
+ (get_local $s)
)
- (if
- (i32.lt_u
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $W)
(get_local $q)
- (get_local $s)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $W)
- (get_local $q)
- )
- (i32.store offset=24
- (get_local $q)
- (get_local $W)
- )
- (br $do-once$27)
+ (i32.store offset=24
+ (get_local $q)
+ (get_local $W)
)
)
)
@@ -2446,7 +2429,6 @@
(get_local $q)
(get_local $W)
)
- (br $do-once$25)
)
)
)
@@ -2905,7 +2887,6 @@
(get_local $i)
(get_local $i)
)
- (br $do-once$29)
)
)
(if
@@ -2958,7 +2939,6 @@
(get_local $i)
(i32.const 0)
)
- (br $do-once$29)
)
(call_import $qa)
)
@@ -3583,78 +3563,73 @@
(get_local $ka)
)
)
- (block $do-once$40
- (if
+ (if
+ (i32.and
+ (i32.gt_u
+ (get_local $ea)
+ (get_local $ka)
+ )
(i32.and
- (i32.gt_u
- (get_local $ea)
+ (i32.lt_u
(get_local $ka)
+ (i32.const 2147483647)
)
- (i32.and
- (i32.lt_u
- (get_local $ka)
- (i32.const 2147483647)
- )
- (i32.ne
- (get_local $ja)
- (i32.const -1)
- )
+ (i32.ne
+ (get_local $ja)
+ (i32.const -1)
)
)
- (if
- (i32.lt_u
- (set_local $e
- (i32.and
- (i32.add
- (i32.sub
- (get_local $ca)
- (get_local $ka)
- )
- (set_local $U
- (i32.load
- (i32.const 1688)
- )
- )
- )
+ )
+ (if
+ (i32.lt_u
+ (set_local $e
+ (i32.and
+ (i32.add
(i32.sub
- (i32.const 0)
- (get_local $U)
+ (get_local $ca)
+ (get_local $ka)
+ )
+ (set_local $U
+ (i32.load
+ (i32.const 1688)
+ )
)
)
- )
- (i32.const 2147483647)
- )
- (if
- (i32.eq
- (call_import $ta
- (get_local $e)
+ (i32.sub
+ (i32.const 0)
+ (get_local $U)
)
- (i32.const -1)
)
- (block
- (call_import $ta
- (get_local $$)
- )
- (br $label$break$d)
+ )
+ (i32.const 2147483647)
+ )
+ (if
+ (i32.eq
+ (call_import $ta
+ (get_local $e)
)
- (block
- (set_local $ma
- (i32.add
- (get_local $e)
- (get_local $ka)
- )
- )
- (br $do-once$40)
+ (i32.const -1)
+ )
+ (block
+ (call_import $ta
+ (get_local $$)
)
+ (br $label$break$d)
)
(set_local $ma
- (get_local $ka)
+ (i32.add
+ (get_local $e)
+ (get_local $ka)
+ )
)
)
(set_local $ma
(get_local $ka)
)
)
+ (set_local $ma
+ (get_local $ka)
+ )
)
(if
(i32.ne
@@ -4487,7 +4462,6 @@
(set_local $ya
(get_local $Ba)
)
- (br $do-once$57)
)
)
)
@@ -4541,7 +4515,6 @@
(set_local $ya
(get_local $e)
)
- (br $do-once$57)
)
(call_import $qa)
)
@@ -4652,34 +4625,31 @@
(get_local $ya)
(get_local $$)
)
- (block $do-once$63
- (if
- (set_local $V
- (i32.load
- (set_local $da
- (i32.add
- (get_local $ma)
- (i32.const 16)
- )
+ (if
+ (set_local $V
+ (i32.load
+ (set_local $da
+ (i32.add
+ (get_local $ma)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $V)
+ (get_local $e)
+ )
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $ya)
(get_local $V)
- (get_local $e)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $ya)
- (get_local $V)
- )
- (i32.store offset=24
- (get_local $V)
- (get_local $ya)
- )
- (br $do-once$63)
+ (i32.store offset=24
+ (get_local $V)
+ (get_local $ya)
)
)
)
@@ -4710,7 +4680,6 @@
(get_local $V)
(get_local $ya)
)
- (br $label$break$e)
)
)
)
@@ -5171,7 +5140,6 @@
(get_local $ka)
(get_local $ka)
)
- (br $do-once$50)
)
)
(if
@@ -5224,7 +5192,6 @@
(get_local $ka)
(i32.const 0)
)
- (br $do-once$50)
)
(call_import $qa)
)
@@ -5894,7 +5861,6 @@
(get_local $ja)
(get_local $ja)
)
- (br $do-once$42)
)
)
(if
@@ -5947,7 +5913,6 @@
(get_local $ja)
(i32.const 0)
)
- (br $do-once$42)
)
(call_import $qa)
)
@@ -6645,7 +6610,6 @@
(set_local $s
(get_local $v)
)
- (br $do-once$2)
)
)
)
@@ -6699,7 +6663,6 @@
(set_local $s
(get_local $j)
)
- (br $do-once$2)
)
(call_import $qa)
)
@@ -6825,34 +6788,31 @@
(get_local $s)
(get_local $g)
)
- (block $do-once$6
- (if
- (set_local $o
- (i32.load
- (set_local $l
- (i32.add
- (get_local $h)
- (i32.const 16)
- )
+ (if
+ (set_local $o
+ (i32.load
+ (set_local $l
+ (i32.add
+ (get_local $h)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $o)
+ (get_local $j)
+ )
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $s)
(get_local $o)
- (get_local $j)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $s)
- (get_local $o)
- )
- (i32.store offset=24
- (get_local $o)
- (get_local $s)
- )
- (br $do-once$6)
+ (i32.store offset=24
+ (get_local $o)
+ (get_local $s)
)
)
)
@@ -6886,7 +6846,6 @@
(set_local $n
(get_local $i)
)
- (br $do-once$0)
)
)
(block
@@ -7331,7 +7290,6 @@
(set_local $y
(get_local $B)
)
- (br $do-once$10)
)
)
)
@@ -7387,7 +7345,6 @@
(set_local $y
(get_local $w)
)
- (br $do-once$10)
)
(call_import $qa)
)
@@ -7498,34 +7455,31 @@
(get_local $y)
(get_local $v)
)
- (block $do-once$14
- (if
- (set_local $h
- (i32.load
- (set_local $i
- (i32.add
- (get_local $f)
- (i32.const 16)
- )
+ (if
+ (set_local $h
+ (i32.load
+ (set_local $i
+ (i32.add
+ (get_local $f)
+ (i32.const 16)
)
)
)
- (if
- (i32.lt_u
+ )
+ (if
+ (i32.lt_u
+ (get_local $h)
+ (get_local $w)
+ )
+ (call_import $qa)
+ (block
+ (i32.store offset=16
+ (get_local $y)
(get_local $h)
- (get_local $w)
)
- (call_import $qa)
- (block
- (i32.store offset=16
- (get_local $y)
- (get_local $h)
- )
- (i32.store offset=24
- (get_local $h)
- (get_local $y)
- )
- (br $do-once$14)
+ (i32.store offset=24
+ (get_local $h)
+ (get_local $y)
)
)
)
@@ -7553,7 +7507,6 @@
(get_local $h)
(get_local $y)
)
- (br $do-once$8)
)
)
)
@@ -7820,228 +7773,224 @@
(get_local $m)
(i32.const 0)
)
- (block $do-once$16
- (if
- (i32.and
- (set_local $E
- (i32.load
- (i32.const 1212)
- )
+ (if
+ (i32.and
+ (set_local $E
+ (i32.load
+ (i32.const 1212)
)
- (set_local $e
- (i32.shl
- (i32.const 1)
- (get_local $G)
- )
+ )
+ (set_local $e
+ (i32.shl
+ (i32.const 1)
+ (get_local $G)
)
)
- (block
- (set_local $F
- (i32.shl
- (get_local $D)
- (if
- (i32.eq
+ )
+ (block
+ (set_local $F
+ (i32.shl
+ (get_local $D)
+ (if
+ (i32.eq
+ (get_local $G)
+ (i32.const 31)
+ )
+ (i32.const 0)
+ (i32.sub
+ (i32.const 25)
+ (i32.shr_u
(get_local $G)
- (i32.const 31)
- )
- (i32.const 0)
- (i32.sub
- (i32.const 25)
- (i32.shr_u
- (get_local $G)
- (i32.const 1)
- )
+ (i32.const 1)
)
)
)
)
- (set_local $b
- (i32.load
- (get_local $s)
- )
+ )
+ (set_local $b
+ (i32.load
+ (get_local $s)
)
- (loop $while-out$18 $while-in$19
- (if
- (i32.eq
- (i32.and
- (i32.load offset=4
- (get_local $b)
- )
- (i32.const -8)
- )
- (get_local $D)
- )
- (block
- (set_local $H
+ )
+ (loop $while-out$18 $while-in$19
+ (if
+ (i32.eq
+ (i32.and
+ (i32.load offset=4
(get_local $b)
)
- (set_local $I
- (i32.const 130)
- )
- (br $while-out$18)
+ (i32.const -8)
)
+ (get_local $D)
)
- (if
- (set_local $y
- (i32.load
- (set_local $n
+ (block
+ (set_local $H
+ (get_local $b)
+ )
+ (set_local $I
+ (i32.const 130)
+ )
+ (br $while-out$18)
+ )
+ )
+ (if
+ (set_local $y
+ (i32.load
+ (set_local $n
+ (i32.add
(i32.add
- (i32.add
- (get_local $b)
- (i32.const 16)
- )
- (i32.shl
- (i32.shr_u
- (get_local $F)
- (i32.const 31)
- )
- (i32.const 2)
+ (get_local $b)
+ (i32.const 16)
+ )
+ (i32.shl
+ (i32.shr_u
+ (get_local $F)
+ (i32.const 31)
)
+ (i32.const 2)
)
)
)
)
- (block
- (set_local $F
- (i32.shl
- (get_local $F)
- (i32.const 1)
- )
- )
- (set_local $b
- (get_local $y)
+ )
+ (block
+ (set_local $F
+ (i32.shl
+ (get_local $F)
+ (i32.const 1)
)
)
- (block
- (set_local $J
- (get_local $n)
- )
- (set_local $K
- (get_local $b)
- )
- (set_local $I
- (i32.const 127)
- )
- (br $while-out$18)
+ (set_local $b
+ (get_local $y)
+ )
+ )
+ (block
+ (set_local $J
+ (get_local $n)
+ )
+ (set_local $K
+ (get_local $b)
+ )
+ (set_local $I
+ (i32.const 127)
+ )
+ (br $while-out$18)
+ )
+ )
+ (br $while-in$19)
+ )
+ (if
+ (i32.eq
+ (get_local $I)
+ (i32.const 127)
+ )
+ (if
+ (i32.lt_u
+ (get_local $J)
+ (i32.load
+ (i32.const 1224)
+ )
+ )
+ (call_import $qa)
+ (block
+ (i32.store
+ (get_local $J)
+ (get_local $m)
+ )
+ (i32.store offset=24
+ (get_local $m)
+ (get_local $K)
+ )
+ (i32.store offset=12
+ (get_local $m)
+ (get_local $m)
+ )
+ (i32.store offset=8
+ (get_local $m)
+ (get_local $m)
)
)
- (br $while-in$19)
)
(if
(i32.eq
(get_local $I)
- (i32.const 127)
+ (i32.const 130)
)
(if
- (i32.lt_u
- (get_local $J)
- (i32.load
- (i32.const 1224)
+ (i32.and
+ (i32.ge_u
+ (set_local $F
+ (i32.load
+ (set_local $b
+ (i32.add
+ (get_local $H)
+ (i32.const 8)
+ )
+ )
+ )
+ )
+ (set_local $i
+ (i32.load
+ (i32.const 1224)
+ )
+ )
+ )
+ (i32.ge_u
+ (get_local $H)
+ (get_local $i)
)
)
- (call_import $qa)
(block
+ (i32.store offset=12
+ (get_local $F)
+ (get_local $m)
+ )
(i32.store
- (get_local $J)
+ (get_local $b)
(get_local $m)
)
- (i32.store offset=24
+ (i32.store offset=8
(get_local $m)
- (get_local $K)
+ (get_local $F)
)
(i32.store offset=12
(get_local $m)
- (get_local $m)
+ (get_local $H)
)
- (i32.store offset=8
- (get_local $m)
+ (i32.store offset=24
(get_local $m)
+ (i32.const 0)
)
- (br $do-once$16)
- )
- )
- (if
- (i32.eq
- (get_local $I)
- (i32.const 130)
- )
- (if
- (i32.and
- (i32.ge_u
- (set_local $F
- (i32.load
- (set_local $b
- (i32.add
- (get_local $H)
- (i32.const 8)
- )
- )
- )
- )
- (set_local $i
- (i32.load
- (i32.const 1224)
- )
- )
- )
- (i32.ge_u
- (get_local $H)
- (get_local $i)
- )
- )
- (block
- (i32.store offset=12
- (get_local $F)
- (get_local $m)
- )
- (i32.store
- (get_local $b)
- (get_local $m)
- )
- (i32.store offset=8
- (get_local $m)
- (get_local $F)
- )
- (i32.store offset=12
- (get_local $m)
- (get_local $H)
- )
- (i32.store offset=24
- (get_local $m)
- (i32.const 0)
- )
- (br $do-once$16)
- )
- (call_import $qa)
)
+ (call_import $qa)
)
)
)
- (block
- (i32.store
- (i32.const 1212)
- (i32.or
- (get_local $E)
- (get_local $e)
- )
- )
- (i32.store
- (get_local $s)
- (get_local $m)
- )
- (i32.store offset=24
- (get_local $m)
- (get_local $s)
- )
- (i32.store offset=12
- (get_local $m)
- (get_local $m)
- )
- (i32.store offset=8
- (get_local $m)
- (get_local $m)
+ )
+ (block
+ (i32.store
+ (i32.const 1212)
+ (i32.or
+ (get_local $E)
+ (get_local $e)
)
)
+ (i32.store
+ (get_local $s)
+ (get_local $m)
+ )
+ (i32.store offset=24
+ (get_local $m)
+ (get_local $s)
+ )
+ (i32.store offset=12
+ (get_local $m)
+ (get_local $m)
+ )
+ (i32.store offset=8
+ (get_local $m)
+ (get_local $m)
+ )
)
)
(i32.store
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt
index d4c50563d..2404e7b39 100644
--- a/test/passes/remove-unused-brs.txt
+++ b/test/passes/remove-unused-brs.txt
@@ -2,23 +2,27 @@
(memory 256 256)
(func $b0-yes (param $i1 i32)
(block $topmost
+ (nop)
)
)
(func $b1 (param $i1 i32)
(block $topmost
- (i32.const 0)
+ (br $topmost
+ (i32.const 0)
+ )
)
)
(func $b2 (param $i1 i32)
(block $topmost
(block $inner
- (br $topmost)
+ (nop)
)
)
)
(func $b3-yes (param $i1 i32)
(block $topmost
(block $inner
+ (nop)
)
)
)
@@ -34,7 +38,9 @@
(func $b5 (param $i1 i32)
(block $topmost
(block $inner
- (i32.const 0)
+ (br $inner
+ (i32.const 0)
+ )
)
)
)
@@ -97,11 +103,15 @@
(i32.const 1)
(block $block1
(i32.const 12)
- (i32.const 1)
+ (br $topmost
+ (i32.const 1)
+ )
)
(block $block3
(i32.const 27)
- (i32.const 2)
+ (br $topmost
+ (i32.const 2)
+ )
)
)
)
@@ -155,4 +165,77 @@
)
)
)
+ (func $b16
+ (block $a
+ (block $b
+ (block $c
+ (br $a)
+ )
+ (br $a)
+ )
+ (nop)
+ )
+ (block $a
+ (block $b
+ (block $c
+ (nop)
+ )
+ (nop)
+ )
+ (nop)
+ )
+ (block $a
+ (block $b
+ (block $c
+ (br $b)
+ )
+ (br $a)
+ )
+ (nop)
+ )
+ )
+ (func $b17
+ (block $a
+ (if
+ (i32.const 0)
+ (block $block1
+ (nop)
+ )
+ (block $block3
+ (nop)
+ )
+ )
+ )
+ (block $a
+ (if
+ (i32.const 0)
+ (i32.const 1)
+ (block $block6
+ (nop)
+ )
+ )
+ )
+ (block $a
+ (if
+ (i32.const 0)
+ (block $block8
+ (nop)
+ )
+ (i32.const 1)
+ )
+ )
+ (block $c
+ (block $b
+ (if
+ (i32.const 0)
+ (block $block11
+ (nop)
+ )
+ (block $block13
+ (nop)
+ )
+ )
+ )
+ )
+ )
)
diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast
index 8e1a557ef..2b3fb14d3 100644
--- a/test/passes/remove-unused-brs.wast
+++ b/test/passes/remove-unused-brs.wast
@@ -157,5 +157,78 @@
)
)
)
+ (func $b16
+ (block $a
+ (block $b
+ (block $c
+ (br $a)
+ )
+ (br $a)
+ )
+ (br $a)
+ )
+ (block $a
+ (block $b
+ (block $c
+ (br $c)
+ )
+ (br $b)
+ )
+ (br $a)
+ )
+ (block $a
+ (block $b
+ (block $c
+ (br $b)
+ )
+ (br $a)
+ )
+ (br $a)
+ )
+ )
+ (func $b17
+ (block $a
+ (if
+ (i32.const 0)
+ (block
+ (br $a)
+ )
+ (block
+ (br $a)
+ )
+ )
+ )
+ (block $a
+ (if
+ (i32.const 0)
+ (i32.const 1)
+ (block
+ (br $a)
+ )
+ )
+ )
+ (block $a
+ (if
+ (i32.const 0)
+ (block
+ (br $a)
+ )
+ (i32.const 1)
+ )
+ )
+ (block $c
+ (block $b
+ (if
+ (i32.const 0)
+ (block
+ (br $b)
+ )
+ (block
+ (br $c)
+ )
+ )
+ )
+ )
+ )
)
diff --git a/test/unit.fromasm b/test/unit.fromasm
index 412bfcace..f3d978c88 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -228,7 +228,6 @@
(loop $while-out$13 $while-in$14
(br $label$break$Lout)
)
- (br $label$break$Lout)
)
)
(loop $label$break$L1 $label$continue$L1
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index 363131ff3..5df8aef72 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -222,7 +222,6 @@
(loop $while-out$13 $while-in$14
(br $label$break$Lout)
)
- (br $label$break$Lout)
)
)
(loop $label$break$L1 $label$continue$L1