diff options
-rwxr-xr-x | auto_update_tests.py | 2 | ||||
-rwxr-xr-x | check.py | 2 | ||||
-rw-r--r-- | src/s2wasm.h | 4 | ||||
-rw-r--r-- | test/dot_s/dead-vreg.wast | 112 |
4 files changed, 118 insertions, 2 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py index dc7656b16..c6bcb7b98 100755 --- a/auto_update_tests.py +++ b/auto_update_tests.py @@ -32,7 +32,7 @@ for t in sorted(os.listdir('test')): open(t, 'w').write(actual) -for s in ['minimal.s', 'basics.s', 'call.s', 'cfg-stackify.s', 'comparisons_f32.s', 'comparisons_f64.s', 'comparisons_i32.s', 'comparisons_i64.s', 'conv.s', 'cpus.s']: +for s in ['minimal.s', 'basics.s', 'call.s', 'cfg-stackify.s', 'comparisons_f32.s', 'comparisons_f64.s', 'comparisons_i32.s', 'comparisons_i64.s', 'conv.s', 'cpus.s', 'dead-vreg.s']: print '..', s wasm = s.replace('.s', '.wast') full = os.path.join('test', 'dot_s', s) @@ -214,7 +214,7 @@ for t in spec_tests: print '\n[ checking .s testcases... ]\n' -for s in ['minimal.s', 'basics.s', 'call.s', 'cfg-stackify.s', 'comparisons_f32.s', 'comparisons_f64.s', 'comparisons_i32.s', 'comparisons_i64.s', 'conv.s', 'cpus.s']: +for s in ['minimal.s', 'basics.s', 'call.s', 'cfg-stackify.s', 'comparisons_f32.s', 'comparisons_f64.s', 'comparisons_i32.s', 'comparisons_i64.s', 'conv.s', 'cpus.s', 'dead-vreg.s']: print '..', s wasm = s.replace('.s', '.wast') full = os.path.join('test', 'dot_s', s) diff --git a/src/s2wasm.h b/src/s2wasm.h index b0fe7c431..aa4512ea9 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -594,6 +594,10 @@ private: } curr->name = getStr(); bstack.back()->list.push_back(curr); + } else if (match("copy_local")) { + Name assign = getAssign(); + skipComma(); + setOutput(getInput(), assign); } else if (match("return")) { Block *temp; if (!(func->body && (temp = func->body->dyn_cast<Block>()) && temp->name == FAKE_RETURN)) { diff --git a/test/dot_s/dead-vreg.wast b/test/dot_s/dead-vreg.wast new file mode 100644 index 000000000..9430bdae6 --- /dev/null +++ b/test/dot_s/dead-vreg.wast @@ -0,0 +1,112 @@ +(module + (memory 0 4294967295) + (func $foo (param $$0 i32) (param $$1 i32) (param $$2 i32) + (local $$3 i32) + (local $$4 i32) + (local $$5 i32) + (local $$6 i32) + (local $$7 i32) + (local $$8 i32) + (local $$9 i32) + (block $fake_return_waka123 + (block + (set_local $$4 + (i32.const 1) + ) + (block $BB0_5 + (br_if + (i32.lt_s + (get_local $$4) + (get_local $$2) + ) + $BB0_5 + ) + (set_local $$3 + (i32.shl + (i32.const 2) + (get_local $$1) + ) + ) + (set_local $$5 + (i32.const 0) + ) + (set_local $$6 + (get_local $$5) + ) + (loop $BB0_2 + (block + (set_local $$7 + (get_local $$5) + ) + (set_local $$8 + (get_local $$0) + ) + (set_local $$9 + (get_local $$1) + ) + (block $BB0_4 + (br_if + (i32.lt_s + (get_local $$4) + (get_local $$1) + ) + $BB0_4 + ) + (loop $BB0_3 + (block + (set_local $$9 + (i32.add + (i32.const -1) + (get_local $$9) + ) + ) + (i32.store align=8 + (get_local $$8) + (get_local $$7) + ) + (set_local $$8 + (i32.add + (i32.const 4) + (get_local $$8) + ) + ) + (set_local $$7 + (i32.add + (get_local $$6) + (get_local $$7) + ) + ) + (br_if + (get_local $$9) + $BB0_3 + ) + ) + ) + ) + (set_local $$6 + (i32.add + (get_local $$4) + (get_local $$6) + ) + ) + (set_local $$0 + (i32.add + (get_local $$3) + (get_local $$0) + ) + ) + (br_if + (i32.ne + (get_local $$2) + (get_local $$6) + ) + $BB0_2 + ) + ) + ) + ) + (br $fake_return_waka123) + ) + ) + ) +) |