summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Bebenita <mbebenita@gmail.com>2016-05-25 19:26:57 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-05-25 19:26:57 -0700
commit948f6fe7c4d2a9256310c07c54724685f27874ac (patch)
tree2431e7bc59cf70c65ffdb8d84cc44ee7a313a79d /test
parent43a9ecd084b828bb715211d91bf412727ff58cff (diff)
downloadbinaryen-948f6fe7c4d2a9256310c07c54724685f27874ac.tar.gz
binaryen-948f6fe7c4d2a9256310c07c54724685f27874ac.tar.bz2
binaryen-948f6fe7c4d2a9256310c07c54724685f27874ac.zip
Add remove unused functions pass. (#463)
Diffstat (limited to 'test')
-rw-r--r--test/passes/remove-unused-functions.txt31
-rw-r--r--test/passes/remove-unused-functions.wast46
2 files changed, 77 insertions, 0 deletions
diff --git a/test/passes/remove-unused-functions.txt b/test/passes/remove-unused-functions.txt
new file mode 100644
index 000000000..171997e14
--- /dev/null
+++ b/test/passes/remove-unused-functions.txt
@@ -0,0 +1,31 @@
+(module
+ (memory 0)
+ (start $start)
+ (export "exported" $exported)
+ (table $called_indirect)
+ (func $start
+ (call $called0)
+ )
+ (func $called0
+ (call $called1)
+ )
+ (func $called1
+ (nop)
+ )
+ (func $called_indirect
+ (nop)
+ )
+ (func $exported
+ (call $called2)
+ )
+ (func $called2
+ (call $called2)
+ (call $called3)
+ )
+ (func $called3
+ (call $called4)
+ )
+ (func $called4
+ (call $called3)
+ )
+)
diff --git a/test/passes/remove-unused-functions.wast b/test/passes/remove-unused-functions.wast
new file mode 100644
index 000000000..4c89804bf
--- /dev/null
+++ b/test/passes/remove-unused-functions.wast
@@ -0,0 +1,46 @@
+(module
+ (start $start)
+ (export "exported" $exported)
+ (table $called_indirect)
+ (func $start
+ (call $called0)
+ )
+ (func $called0
+ (call $called1)
+ )
+ (func $called1
+ (nop)
+ )
+ (func $called_indirect
+ (nop)
+ )
+ (func $exported
+ (call $called2)
+ )
+ (func $called2
+ (call $called2)
+ (call $called3)
+ )
+ (func $called3
+ (call $called4)
+ )
+ (func $called4
+ (call $called3)
+ )
+ (func $remove0
+ (call $remove1)
+ )
+ (func $remove1
+ (nop)
+ )
+ (func $remove2
+ (call $remove2)
+ )
+ (func $remove3
+ (call $remove4)
+ )
+ (func $remove4
+ (call $remove3)
+ )
+)
+