summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-05-28 15:03:26 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-05-28 16:47:04 -0700
commit44aeb85b2fa2c743e2d0f7e00349f99cfcbc7639 (patch)
treef0f7a4bc5cd7d948f4285298b3b3930f30cc0185 /test
parentb426fda5e43f612ddd122b6aa25a8dd0a549b64f (diff)
downloadbinaryen-44aeb85b2fa2c743e2d0f7e00349f99cfcbc7639.tar.gz
binaryen-44aeb85b2fa2c743e2d0f7e00349f99cfcbc7639.tar.bz2
binaryen-44aeb85b2fa2c743e2d0f7e00349f99cfcbc7639.zip
add a pass that eliminates duplicate functions
Diffstat (limited to 'test')
-rw-r--r--test/example/c-api-kitchen-sink.txt33
-rw-r--r--test/hello_libcxx.cpp8
-rw-r--r--test/passes/duplicate-function-elimination.txt864
-rw-r--r--test/passes/duplicate-function-elimination.wast702
-rw-r--r--test/unit.fromasm23
-rw-r--r--test/unit.fromasm.imprecise23
6 files changed, 1576 insertions, 77 deletions
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 27cd7d91e..52b6cd6ed 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -635,39 +635,6 @@ optimized:
(func $just-one-block (type $v)
(nop)
)
- (func $two-blocks (type $v)
- (nop)
- )
- (func $two-blocks-plus-code (type $v)
- (nop)
- )
- (func $loop (type $v)
- (nop)
- )
- (func $loop-plus-code (type $v)
- (nop)
- )
- (func $split (type $v)
- (nop)
- )
- (func $split-plus-code (type $v)
- (nop)
- )
- (func $if (type $v)
- (nop)
- )
- (func $if-plus-code (type $v)
- (nop)
- )
- (func $if-else (type $v)
- (nop)
- )
- (func $loop-tail (type $v)
- (nop)
- )
- (func $nontrivial-loop-plus-phi-to-head (type $v)
- (nop)
- )
)
module loaded from binary form:
(module
diff --git a/test/hello_libcxx.cpp b/test/hello_libcxx.cpp
new file mode 100644
index 000000000..445c5513b
--- /dev/null
+++ b/test/hello_libcxx.cpp
@@ -0,0 +1,8 @@
+#include <iostream>
+
+int main()
+{
+ std::cout << "hello, world!" << std::endl;
+ return 0;
+}
+
diff --git a/test/passes/duplicate-function-elimination.txt b/test/passes/duplicate-function-elimination.txt
new file mode 100644
index 000000000..9595f5705
--- /dev/null
+++ b/test/passes/duplicate-function-elimination.txt
@@ -0,0 +1,864 @@
+(module
+ (memory 0)
+ (func $erase
+ (nop)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (nop)
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (i32.const 0)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (i32.const 1)
+ )
+)
+(module
+ (memory 0)
+ (start $keep2)
+ (export "keep2" $keep2)
+ (export "other" $keep2)
+ (table $keep2 $keep2 $caller)
+ (func $keep2
+ (nop)
+ )
+ (func $caller
+ (call $keep2)
+ (call $keep2)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2-after-two-passes
+ (nop)
+ )
+ (func $keep-caller
+ (call $keep2-after-two-passes)
+ )
+)
+(module
+ (memory 0)
+ (func $keep-4
+ (nop)
+ )
+ (func $other
+ (unreachable)
+ )
+ (func $keep-caller
+ (call $keep-4)
+ )
+ (func $other-caller
+ (call $other)
+ )
+)
+(module
+ (memory 0)
+ (type $T (func (result i32)))
+ (type $S (func (result i32)))
+ (func $keep4-similar-but-func-sig-differs
+ (i32.const 0)
+ )
+ (func $other1 (param $i i32)
+ (i32.const 0)
+ )
+ (func $other2 (type $T) (result i32)
+ (i32.const 0)
+ )
+ (func $other3 (type $S) (result i32)
+ (i32.const 0)
+ )
+)
+(module
+ (memory 0)
+ (type $S (func (result i32)))
+ (func $keep2-similar-but-func-sig-differs (param $i i32)
+ (i32.const 0)
+ )
+ (func $other2 (type $S) (result i32)
+ (i32.const 0)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (nop)
+ )
+ (func $other
+ (nop)
+ (nop)
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (block $block0
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (block $block0
+ )
+ )
+ (func $other
+ (block $block0
+ (nop)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (block $block0
+ (nop)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (block $block0
+ (nop)
+ )
+ )
+ (func $other
+ (block $block0
+ (nop)
+ (unreachable)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (block $block0
+ (nop)
+ )
+ )
+ (func $other
+ (block $block0
+ (unreachable)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase-since-block-names-do-not-matter
+ (block $foo
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase-since-block-names-do-not-matter
+ (block $foo
+ (br $foo)
+ (br_table $foo $foo
+ (i32.const 0)
+ )
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (block $foo
+ (br $foo
+ (i32.const 0)
+ )
+ )
+ )
+ (func $other
+ (block $bar
+ (br $bar
+ (i32.const 1)
+ )
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (block $foo
+ (br_if $foo
+ (i32.const 0)
+ )
+ )
+ )
+ (func $other
+ (block $bar
+ (br_if $bar
+ (i32.const 1)
+ )
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (block $foo
+ (br_if $foo
+ (i32.const 0)
+ )
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (block $foo
+ (br_table $foo $foo
+ (i32.const 0)
+ )
+ )
+ )
+ (func $other
+ (block $bar
+ (br_table $bar $bar
+ (i32.const 1)
+ )
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (loop $foo $bar
+ (nop)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (block $foo
+ (br_table $foo $foo
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ )
+ (func $other
+ (block $bar
+ (br_table $bar $bar
+ (i32.const 0)
+ (i32.const 1)
+ )
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (block $foo
+ (block $bar
+ (br_table $foo $bar
+ (i32.const 0)
+ )
+ )
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (block $foo
+ (block $bar
+ (br_table $foo $bar
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $other
+ (block $bar
+ (block $foo
+ (br_table $foo $bar
+ (i32.const 0)
+ )
+ )
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (call $erase)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2-but-in-theory-we-could-erase
+ (call $keep2-but-in-theory-we-could-erase)
+ )
+ (func $other
+ (call $other)
+ )
+)
+(module
+ (memory 0)
+ (type $FUNCSIG$v (func))
+ (import $i "env" "i")
+ (import $i "env" "j")
+ (func $erase
+ (call_import $i)
+ )
+)
+(module
+ (memory 0)
+ (type $FUNCSIG$v (func))
+ (import $i "env" "i")
+ (import $j "env" "j")
+ (func $keep2
+ (call_import $i)
+ )
+ (func $other
+ (call_import $j)
+ )
+)
+(module
+ (memory 0)
+ (type $T (func))
+ (table $erase $erase)
+ (func $erase
+ (call_indirect $T
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (type $T (func))
+ (table $keep2 $other)
+ (func $keep2
+ (call_indirect $T
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (call_indirect $T
+ (i32.const 1)
+ )
+ )
+)
+(module
+ (memory 0)
+ (type $T (func))
+ (type $S (func))
+ (table $keep2 $other)
+ (func $keep2
+ (call_indirect $T
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (call_indirect $S
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase-even-locals-with-different-names
+ (local $i i32)
+ (get_local $i)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (local $i i32)
+ (get_local $i)
+ )
+ (func $other
+ (local $j i64)
+ (get_local $j)
+ )
+)
+(module
+ (memory 0)
+ (func $erase-even-locals-with-different-names
+ (local $i i32)
+ (set_local $i
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (local $i i32)
+ (set_local $i
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (local $j i64)
+ (set_local $j
+ (i64.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (local $i i32)
+ (set_local $i
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (local $j i32)
+ (set_local $j
+ (i32.const 1)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $erase
+ (i32.load
+ (i32.const 0)
+ )
+ (i32.load8_s offset=3 align=2
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load16_s offset=3
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (i32.load8_s offset=3 align=2
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load8_s offset=3
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (i32.load8_s offset=3 align=2
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load8_s align=2
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (i32.load8_s offset=3 align=2
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load8_s offset=3 align=2
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (i32.load8_s offset=3 align=2
+ (i32.const 1)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load8_u offset=3 align=2
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (i32.load8_s offset=3 align=2
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $erase
+ (i32.store
+ (i32.const 0)
+ (i32.const 100)
+ )
+ (i32.store8 offset=3 align=2
+ (i32.const 0)
+ (i32.const 100)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store16 offset=3
+ (i32.const 0)
+ (i32.const 100)
+ )
+ )
+ (func $other
+ (i32.store8 offset=3 align=2
+ (i32.const 0)
+ (i32.const 100)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store8 offset=3
+ (i32.const 0)
+ (i32.const 100)
+ )
+ )
+ (func $other
+ (i32.store8 offset=3 align=2
+ (i32.const 0)
+ (i32.const 100)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store8 align=2
+ (i32.const 0)
+ (i32.const 100)
+ )
+ )
+ (func $other
+ (i32.store8 offset=3 align=2
+ (i32.const 0)
+ (i32.const 100)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store8 offset=3 align=2
+ (i32.const 0)
+ (i32.const 100)
+ )
+ )
+ (func $other
+ (i32.store8 offset=3 align=2
+ (i32.const 1)
+ (i32.const 100)
+ )
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store8 offset=3 align=2
+ (i32.const 0)
+ (i32.const 100)
+ )
+ )
+ (func $other
+ (i32.store8 offset=3 align=2
+ (i32.const 0)
+ (i32.const 101)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (i64.const 0)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (f32.const 0)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (f64.const 0)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (i64.const 0)
+ )
+ (func $other
+ (i64.const 1)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (f32.const 0.10000000149011612)
+ )
+ (func $other
+ (f32.const -0.10000000149011612)
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (f64.const 0.1)
+ )
+ (func $other
+ (f64.const 0.2)
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (f32.abs
+ (f32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (f32.abs
+ (f32.const 0)
+ )
+ )
+ (func $other
+ (f32.abs
+ (f32.const 1)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (f32.abs
+ (f32.const 0)
+ )
+ )
+ (func $other
+ (f32.neg
+ (f32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (f32.add
+ (f32.const 0)
+ (f32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (f32.add
+ (f32.const 0)
+ (f32.const 0)
+ )
+ )
+ (func $other
+ (f32.add
+ (f32.const 0)
+ (f32.const 1)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (f32.add
+ (f32.const 0)
+ (f32.const 0)
+ )
+ )
+ (func $other
+ (f32.add
+ (f32.const 1)
+ (f32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep2
+ (f32.add
+ (f32.const 0)
+ (f32.const 0)
+ )
+ )
+ (func $other
+ (f32.sub
+ (f32.const 0)
+ (f32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (select
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep
+ (select
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (select
+ (i32.const 1)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep
+ (select
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (select
+ (i32.const 0)
+ (i32.const 2)
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep
+ (select
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ (func $other
+ (select
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 3)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (return)
+ )
+)
+(module
+ (memory 0)
+ (func $erase (result i32)
+ (return
+ (i32.const 0)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep (result i32)
+ (return
+ (i32.const 0)
+ )
+ )
+ (func $other (result i32)
+ (return
+ (i32.const 1)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (current_memory)
+ )
+)
+(module
+ (memory 0)
+ (func $erase
+ (grow_memory
+ (i32.const 10)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep
+ (grow_memory
+ (i32.const 10)
+ )
+ )
+ (func $other
+ (grow_memory
+ (i32.const 11)
+ )
+ )
+)
+(module
+ (memory 0)
+ (func $keep
+ (current_memory)
+ )
+ (func $other
+ (grow_memory
+ (i32.const 10)
+ )
+ )
+)
diff --git a/test/passes/duplicate-function-elimination.wast b/test/passes/duplicate-function-elimination.wast
new file mode 100644
index 000000000..8d1a85cd5
--- /dev/null
+++ b/test/passes/duplicate-function-elimination.wast
@@ -0,0 +1,702 @@
+(module
+ (func $erase
+ (nop)
+ )
+ (func $other
+ (nop)
+ )
+)
+(module
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (nop)
+ )
+)
+(module
+ (func $erase
+ (i32.const 0)
+ )
+ (func $other
+ (i32.const 0)
+ )
+)
+(module
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (i32.const 1)
+ )
+)
+(module
+ (export "keep2" $keep2)
+ (export "other" $other)
+ (start $other)
+ (table $keep2 $other $caller)
+ (func $keep2
+ (nop)
+ )
+ (func $other
+ (nop)
+ )
+ (func $caller
+ (call $keep2)
+ (call $other)
+ )
+)
+(module
+ (func $keep2-after-two-passes
+ (nop)
+ )
+ (func $other
+ (nop)
+ )
+ (func $keep-caller
+ (call $keep2-after-two-passes)
+ )
+ (func $other-caller
+ (call $other)
+ )
+)
+(module
+ (func $keep-4
+ (nop)
+ )
+ (func $other
+ (unreachable)
+ )
+ (func $keep-caller
+ (call $keep-4)
+ )
+ (func $other-caller
+ (call $other)
+ )
+)
+(module
+ (type T (func (result i32)))
+ (type S (func (result i32)))
+ (func $keep4-similar-but-func-sig-differs
+ (i32.const 0)
+ )
+ (func $other1 (param $i i32)
+ (i32.const 0)
+ )
+ (func $other2 (type $T) (result i32)
+ (i32.const 0)
+ )
+ (func $other3 (type $S) (result i32)
+ (i32.const 0)
+ )
+)
+(module
+ (type S (func (result i32)))
+ (func $keep2-similar-but-func-sig-differs (param $i i32)
+ (i32.const 0)
+ )
+ (func $other1 (param $i i32)
+ (i32.const 0)
+ )
+ (func $other2 (type $S) (result i32)
+ (i32.const 0)
+ )
+ (func $other3 (type $S) (result i32)
+ (i32.const 0)
+ )
+)
+;; hashing tests for expressions
+(module
+ (func $keep2
+ (nop)
+ )
+ (func $other
+ (nop)
+ (nop)
+ )
+)
+(module
+ (func $erase
+ (block)
+ )
+ (func $other
+ (block)
+ )
+)
+(module
+ (func $keep2
+ (block)
+ )
+ (func $other
+ (block (nop))
+ )
+)
+(module
+ (func $erase
+ (block (nop))
+ )
+ (func $other
+ (block (nop))
+ )
+)
+(module
+ (func $keep2
+ (block (nop))
+ )
+ (func $other
+ (block (nop) (unreachable))
+ )
+)
+(module
+ (func $keep2
+ (block (nop))
+ )
+ (func $other
+ (block (unreachable))
+ )
+)
+(module
+ (func $erase-since-block-names-do-not-matter
+ (block $foo)
+ )
+ (func $other
+ (block $bar)
+ )
+)
+(module
+ (func $erase-since-block-names-do-not-matter
+ (block $foo
+ (br $foo)
+ (br_table $foo $foo (i32.const 0))
+ )
+ )
+ (func $other
+ (block $bar
+ (br $bar)
+ (br_table $bar $bar (i32.const 0))
+ )
+ )
+)
+(module
+ (func $keep2
+ (block $foo
+ (br $foo (i32.const 0))
+ )
+ )
+ (func $other
+ (block $bar
+ (br $bar (i32.const 1))
+ )
+ )
+)
+(module
+ (func $keep2
+ (block $foo
+ (br_if $foo (i32.const 0))
+ )
+ )
+ (func $other
+ (block $bar
+ (br_if $bar (i32.const 1))
+ )
+ )
+)
+(module
+ (func $erase
+ (block $foo
+ (br_if $foo (i32.const 0))
+ )
+ )
+ (func $other
+ (block $bar
+ (br_if $bar (i32.const 0))
+ )
+ )
+)
+(module
+ (func $keep2
+ (block $foo
+ (br_table $foo $foo (i32.const 0))
+ )
+ )
+ (func $other
+ (block $bar
+ (br_table $bar $bar (i32.const 1))
+ )
+ )
+)
+(module
+ (func $erase
+ (loop $foo $bar)
+ )
+ (func $other
+ (loop $sfo $sjc)
+ )
+)
+(module
+ (func $keep2
+ (block $foo
+ (br_table $foo $foo (i32.const 0) (i32.const 0))
+ )
+ )
+ (func $other
+ (block $bar
+ (br_table $bar $bar (i32.const 0) (i32.const 1))
+ )
+ )
+)
+(module
+ (func $keep2
+ (block $foo
+ (block $bar
+ (br_table $foo $bar (i32.const 0))
+ )
+ )
+ )
+ (func $other
+ (block $bar
+ (block $foo
+ (br_table $bar $foo (i32.const 0))
+ )
+ )
+ )
+)
+(module
+ (func $erase
+ (block $foo
+ (block $bar
+ (br_table $foo $bar (i32.const 0))
+ )
+ )
+ )
+ (func $other
+ (block $bar
+ (block $foo
+ (br_table $foo $bar (i32.const 0))
+ )
+ )
+ )
+)
+(module
+ (func $erase
+ (call $erase)
+ )
+ (func $other
+ (call $erase)
+ )
+)
+(module
+ (func $keep2-but-in-theory-we-could-erase ;; TODO FIXME
+ (call $keep2-but-in-theory-we-could-erase)
+ )
+ (func $other
+ (call $other)
+ )
+)
+(module
+ (import $i "env" "i")
+ (import $i "env" "j")
+ (func $erase
+ (call_import $i)
+ )
+ (func $other
+ (call_import $i)
+ )
+)
+(module
+ (import $i "env" "i")
+ (import $j "env" "j")
+ (func $keep2
+ (call_import $i)
+ )
+ (func $other
+ (call_import $j)
+ )
+)
+(module
+ (type T (func))
+ (table $erase $other)
+ (func $erase
+ (call_indirect $T (i32.const 0))
+ )
+ (func $other
+ (call_indirect $T (i32.const 0))
+ )
+)
+(module
+ (type T (func))
+ (table $keep2 $other)
+ (func $keep2
+ (call_indirect $T (i32.const 0))
+ )
+ (func $other
+ (call_indirect $T (i32.const 1))
+ )
+)
+(module
+ (type T (func))
+ (type S (func))
+ (table $keep2 $other)
+ (func $keep2
+ (call_indirect $T (i32.const 0))
+ )
+ (func $other
+ (call_indirect $S (i32.const 0))
+ )
+)
+(module
+ (func $erase-even-locals-with-different-names
+ (local $i i32)
+ (get_local $i)
+ )
+ (func $other
+ (local $j i32)
+ (get_local $j)
+ )
+)
+(module
+ (func $keep2
+ (local $i i32)
+ (get_local $i)
+ )
+ (func $other
+ (local $j i64)
+ (get_local $j)
+ )
+)
+(module
+ (func $erase-even-locals-with-different-names
+ (local $i i32)
+ (set_local $i (i32.const 0))
+ )
+ (func $other
+ (local $j i32)
+ (set_local $j (i32.const 0))
+ )
+)
+(module
+ (func $keep2
+ (local $i i32)
+ (set_local $i (i32.const 0))
+ )
+ (func $other
+ (local $j i64)
+ (set_local $j (i64.const 0))
+ )
+)
+(module
+ (func $keep2
+ (local $i i32)
+ (set_local $i (i32.const 0))
+ )
+ (func $other
+ (local $j i32)
+ (set_local $j (i32.const 1))
+ )
+)
+(module
+ (memory 10)
+ (func $erase
+ (i32.load (i32.const 0))
+ (i32.load8_s align=2 offset=3 (i32.const 0))
+ )
+ (func $other
+ (i32.load (i32.const 0))
+ (i32.load8_s align=2 offset=3 (i32.const 0))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load16_s align=2 offset=3 (i32.const 0))
+ )
+ (func $other
+ (i32.load8_s align=2 offset=3 (i32.const 0))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load8_s offset=3 (i32.const 0))
+ )
+ (func $other
+ (i32.load8_s align=2 offset=3 (i32.const 0))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load8_s align=2 (i32.const 0))
+ )
+ (func $other
+ (i32.load8_s align=2 offset=3 (i32.const 0))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load8_s align=2 offset=3 (i32.const 0))
+ )
+ (func $other
+ (i32.load8_s align=2 offset=3 (i32.const 1))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.load8_u align=2 offset=3 (i32.const 0))
+ )
+ (func $other
+ (i32.load8_s align=2 offset=3 (i32.const 0))
+ )
+)
+
+(module
+ (memory 10)
+ (func $erase
+ (i32.store (i32.const 0) (i32.const 100))
+ (i32.store8 align=2 offset=3 (i32.const 0) (i32.const 100))
+ )
+ (func $other
+ (i32.store (i32.const 0) (i32.const 100))
+ (i32.store8 align=2 offset=3 (i32.const 0) (i32.const 100))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store16 align=2 offset=3 (i32.const 0) (i32.const 100))
+ )
+ (func $other
+ (i32.store8 align=2 offset=3 (i32.const 0) (i32.const 100))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store8 offset=3 (i32.const 0) (i32.const 100))
+ )
+ (func $other
+ (i32.store8 align=2 offset=3 (i32.const 0) (i32.const 100))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store8 align=2 (i32.const 0) (i32.const 100))
+ )
+ (func $other
+ (i32.store8 align=2 offset=3 (i32.const 0) (i32.const 100))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store8 align=2 offset=3 (i32.const 0) (i32.const 100))
+ )
+ (func $other
+ (i32.store8 align=2 offset=3 (i32.const 1) (i32.const 100))
+ )
+)
+(module
+ (memory 10)
+ (func $keep2
+ (i32.store8 align=2 offset=3 (i32.const 0) (i32.const 100))
+ )
+ (func $other
+ (i32.store8 align=2 offset=3 (i32.const 0) (i32.const 101))
+ )
+)
+(module
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (i64.const 0)
+ )
+)
+(module
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (f32.const 0)
+ )
+)
+(module
+ (func $keep2
+ (i32.const 0)
+ )
+ (func $other
+ (f64.const 0)
+ )
+)
+(module
+ (func $keep2
+ (i64.const 0)
+ )
+ (func $other
+ (i64.const 1)
+ )
+)
+(module
+ (func $keep2
+ (f32.const 0.1)
+ )
+ (func $other
+ (f32.const -0.1)
+ )
+)
+(module
+ (func $keep2
+ (f64.const 0.1)
+ )
+ (func $other
+ (f64.const 0.2)
+ )
+)
+(module
+ (func $erase
+ (f32.abs (f32.const 0))
+ )
+ (func $other
+ (f32.abs (f32.const 0))
+ )
+)
+(module
+ (func $keep2
+ (f32.abs (f32.const 0))
+ )
+ (func $other
+ (f32.abs (f32.const 1))
+ )
+)
+(module
+ (func $keep2
+ (f32.abs (f32.const 0))
+ )
+ (func $other
+ (f32.neg (f32.const 0))
+ )
+)
+(module
+ (func $erase
+ (f32.add (f32.const 0) (f32.const 0))
+ )
+ (func $other
+ (f32.add (f32.const 0) (f32.const 0))
+ )
+)
+(module
+ (func $keep2
+ (f32.add (f32.const 0) (f32.const 0))
+ )
+ (func $other
+ (f32.add (f32.const 0) (f32.const 1))
+ )
+)
+(module
+ (func $keep2
+ (f32.add (f32.const 0) (f32.const 0))
+ )
+ (func $other
+ (f32.add (f32.const 1) (f32.const 0))
+ )
+)
+(module
+ (func $keep2
+ (f32.add (f32.const 0) (f32.const 0))
+ )
+ (func $other
+ (f32.sub (f32.const 0) (f32.const 0))
+ )
+)
+(module
+ (func $erase
+ (select (i32.const 0) (i32.const 0) (i32.const 0))
+ )
+ (func $other
+ (select (i32.const 0) (i32.const 0) (i32.const 0))
+ )
+)
+(module
+ (func $keep
+ (select (i32.const 0) (i32.const 0) (i32.const 0))
+ )
+ (func $other
+ (select (i32.const 1) (i32.const 0) (i32.const 0))
+ )
+)
+(module
+ (func $keep
+ (select (i32.const 0) (i32.const 0) (i32.const 0))
+ )
+ (func $other
+ (select (i32.const 0) (i32.const 2) (i32.const 0))
+ )
+)
+(module
+ (func $keep
+ (select (i32.const 0) (i32.const 0) (i32.const 0))
+ )
+ (func $other
+ (select (i32.const 0) (i32.const 0) (i32.const 3))
+ )
+)
+(module
+ (func $erase
+ (return)
+ )
+ (func $other
+ (return)
+ )
+)
+(module
+ (func $erase (result i32)
+ (return (i32.const 0))
+ )
+ (func $other (result i32)
+ (return (i32.const 0))
+ )
+)
+(module
+ (func $keep (result i32)
+ (return (i32.const 0))
+ )
+ (func $other (result i32)
+ (return (i32.const 1))
+ )
+)
+(module
+ (func $erase
+ (current_memory)
+ )
+ (func $other
+ (current_memory)
+ )
+)
+(module
+ (func $erase
+ (grow_memory (i32.const 10))
+ )
+ (func $other
+ (grow_memory (i32.const 10))
+ )
+)
+(module
+ (func $keep
+ (grow_memory (i32.const 10))
+ )
+ (func $other
+ (grow_memory (i32.const 11))
+ )
+)
+(module
+ (func $keep
+ (current_memory)
+ )
+ (func $other
+ (grow_memory (i32.const 10))
+ )
+)
+
diff --git a/test/unit.fromasm b/test/unit.fromasm
index b51ff4ba1..288b3af3b 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -11,7 +11,7 @@
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
(import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))
(export "big_negative" $big_negative)
- (table $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
+ (table $big_negative $big_negative $big_negative $big_negative $big_negative $big_negative $importedDoubles $big_negative $big_negative $cneg)
(func $big_negative
(nop)
)
@@ -87,9 +87,6 @@
(get_local $0)
)
)
- (func $hexLiterals
- (nop)
- )
(func $conversions
(local $0 f64)
(local $1 f32)
@@ -105,9 +102,6 @@
)
)
)
- (func $seq
- (nop)
- )
(func $switcher (param $0 i32) (result i32)
(block $switch-default$3
(block $switch-case$2
@@ -205,9 +199,6 @@
)
(i32.const 0)
)
- (func $blocker
- (nop)
- )
(func $frem (result f64)
(call_import $f64-rem
(f64.const 5.5)
@@ -229,9 +220,6 @@
(func $negZero (result f64)
(f64.const -0)
)
- (func $abs
- (nop)
- )
(func $neg
(local $0 f32)
(call_indirect $FUNCSIG$vf
@@ -259,9 +247,6 @@
(get_local $0)
)
)
- (func $___syscall_ret
- (nop)
- )
(func $smallCompare (result i32)
(local $0 i32)
(local $1 i32)
@@ -439,10 +424,4 @@
)
(i32.const 0)
)
- (func $z
- (nop)
- )
- (func $w
- (nop)
- )
)
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index 0ea85eb6c..303a0cabf 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -9,7 +9,7 @@
(import $h "env" "h" (param i32))
(import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))
(export "big_negative" $big_negative)
- (table $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
+ (table $big_negative $big_negative $big_negative $big_negative $big_negative $big_negative $importedDoubles $big_negative $big_negative $cneg)
(func $big_negative
(nop)
)
@@ -85,9 +85,6 @@
(get_local $0)
)
)
- (func $hexLiterals
- (nop)
- )
(func $conversions
(local $0 f32)
(local $1 i32)
@@ -97,9 +94,6 @@
)
)
)
- (func $seq
- (nop)
- )
(func $switcher (param $0 i32) (result i32)
(block $switch-default$3
(block $switch-case$2
@@ -197,9 +191,6 @@
)
(i32.const 0)
)
- (func $blocker
- (nop)
- )
(func $frem (result f64)
(call_import $f64-rem
(f64.const 5.5)
@@ -221,9 +212,6 @@
(func $negZero (result f64)
(f64.const -0)
)
- (func $abs
- (nop)
- )
(func $neg
(local $0 f32)
(call_indirect $FUNCSIG$vf
@@ -251,9 +239,6 @@
(get_local $0)
)
)
- (func $___syscall_ret
- (nop)
- )
(func $smallCompare (result i32)
(local $0 i32)
(local $1 i32)
@@ -431,10 +416,4 @@
)
(i32.const 0)
)
- (func $z
- (nop)
- )
- (func $w
- (nop)
- )
)