diff options
Diffstat (limited to 'test/passes')
-rw-r--r-- | test/passes/remove-unused-module-elements.txt | 47 | ||||
-rw-r--r-- | test/passes/remove-unused-module-elements.wast | 36 |
2 files changed, 76 insertions, 7 deletions
diff --git a/test/passes/remove-unused-module-elements.txt b/test/passes/remove-unused-module-elements.txt index 5fa7d005a..abce5a5aa 100644 --- a/test/passes/remove-unused-module-elements.txt +++ b/test/passes/remove-unused-module-elements.txt @@ -1,10 +1,14 @@ (module (type $0 (func)) + (type $1 (func (param i32))) + (type $2 (func (param i32) (result i32))) (table 1 1 anyfunc) (elem (i32.const 0) $called_indirect) (memory $0 0) (export "memory" (memory $0)) (export "exported" (func $exported)) + (export "other1" (func $other1)) + (export "other2" (func $other2)) (start $start) (func $start (type $0) (call $called0) @@ -31,6 +35,49 @@ (func $called4 (type $0) (call $called3) ) + (func $other1 (type $1) (param $0 i32) + (call_indirect $0 + (i32.const 0) + ) + (call_indirect $0 + (i32.const 0) + ) + (call_indirect $0 + (i32.const 0) + ) + (call_indirect $0 + (i32.const 0) + ) + (call_indirect $1 + (i32.const 0) + (i32.const 0) + ) + (call_indirect $1 + (i32.const 0) + (i32.const 0) + ) + (drop + (call_indirect $2 + (i32.const 0) + (i32.const 0) + ) + ) + (drop + (call_indirect $2 + (i32.const 0) + (i32.const 0) + ) + ) + (drop + (call_indirect $2 + (i32.const 0) + (i32.const 0) + ) + ) + ) + (func $other2 (type $1) (param $0 i32) + (unreachable) + ) ) (module (import "env" "memory" (memory $0 256)) diff --git a/test/passes/remove-unused-module-elements.wast b/test/passes/remove-unused-module-elements.wast index eb071ee66..e0ae7b4ec 100644 --- a/test/passes/remove-unused-module-elements.wast +++ b/test/passes/remove-unused-module-elements.wast @@ -2,8 +2,16 @@ (memory 0) (start $start) (type $0 (func)) + (type $0-dupe (func)) + (type $1 (func (param i32))) + (type $1-dupe (func (param i32))) + (type $2 (func (param i32) (result i32))) + (type $2-dupe (func (param i32) (result i32))) + (type $2-thrupe (func (param i32) (result i32))) (export "memory" (memory $0)) (export "exported" $exported) + (export "other1" $other1) + (export "other2" $other2) (table 1 1 anyfunc) (elem (i32.const 0) $called_indirect) (func $start (type $0) @@ -18,26 +26,26 @@ (func $called_indirect (type $0) (nop) ) - (func $exported (type $0) + (func $exported (type $0-dupe) (call $called2) ) - (func $called2 (type $0) + (func $called2 (type $0-dupe) (call $called2) (call $called3) ) - (func $called3 (type $0) + (func $called3 (type $0-dupe) (call $called4) ) - (func $called4 (type $0) + (func $called4 (type $0-dupe) (call $called3) ) - (func $remove0 (type $0) + (func $remove0 (type $0-dupe) (call $remove1) ) - (func $remove1 (type $0) + (func $remove1 (type $0-dupe) (nop) ) - (func $remove2 (type $0) + (func $remove2 (type $0-dupe) (call $remove2) ) (func $remove3 (type $0) @@ -46,6 +54,20 @@ (func $remove4 (type $0) (call $remove3) ) + (func $other1 (param i32) (type $1) + (call_indirect $0 (i32.const 0)) + (call_indirect $0 (i32.const 0)) + (call_indirect $0-dupe (i32.const 0)) + (call_indirect $0-dupe (i32.const 0)) + (call_indirect $1 (i32.const 0) (i32.const 0)) + (call_indirect $1-dupe (i32.const 0) (i32.const 0)) + (drop (call_indirect $2 (i32.const 0) (i32.const 0))) + (drop (call_indirect $2-dupe (i32.const 0) (i32.const 0))) + (drop (call_indirect $2-thrupe (i32.const 0) (i32.const 0))) + ) + (func $other2 (param i32) (type $1-dupe) + (unreachable) + ) ) (module ;; leave the table and memory alone (import "env" "memory" (memory $0 256)) |