diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/duplicate-function-elimination_optimize-level=1.txt | 1068 | ||||
-rw-r--r-- | test/passes/duplicate-function-elimination_optimize-level=1.wast (renamed from test/passes/duplicate-function-elimination.wast) | 0 | ||||
-rw-r--r-- | test/passes/duplicate-function-elimination_optimize-level=2.txt (renamed from test/passes/duplicate-function-elimination.txt) | 0 | ||||
-rw-r--r-- | test/passes/duplicate-function-elimination_optimize-level=2.wast | 1221 | ||||
-rw-r--r-- | test/passes/remove-unused-names_code-folding.txt | 12 |
5 files changed, 2295 insertions, 6 deletions
diff --git a/test/passes/duplicate-function-elimination_optimize-level=1.txt b/test/passes/duplicate-function-elimination_optimize-level=1.txt new file mode 100644 index 000000000..c44b4cc28 --- /dev/null +++ b/test/passes/duplicate-function-elimination_optimize-level=1.txt @@ -0,0 +1,1068 @@ +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (nop) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $0) + (nop) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (drop + (i32.const 0) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (i32.const 1) + ) + ) +) +(module + (type $0 (func)) + (table 3 3 anyfunc) + (elem (i32.const 0) $keep2 $keep2 $caller) + (memory $0 0) + (export "keep2" (func $keep2)) + (export "other" (func $keep2)) + (start $keep2) + (func $keep2 (; 0 ;) (type $0) + (nop) + ) + (func $caller (; 1 ;) (type $0) + (call $keep2) + (call $keep2) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2-after-two-passes (; 0 ;) (type $0) + (nop) + ) + (func $keep-caller (; 1 ;) (type $0) + (call $keep2-after-two-passes) + ) + (func $other-caller (; 2 ;) (type $0) + (call $keep2-after-two-passes) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep-4 (; 0 ;) (type $0) + (nop) + ) + (func $other (; 1 ;) (type $0) + (unreachable) + ) + (func $keep-caller (; 2 ;) (type $0) + (call $keep-4) + ) + (func $other-caller (; 3 ;) (type $0) + (call $other) + ) +) +(module + (type $T (func (result i32))) + (type $S (func (result i32))) + (type $2 (func)) + (type $3 (func (param i32))) + (memory $0 0) + (func $keep4-similar-but-func-sig-differs (; 0 ;) (type $2) + (drop + (i32.const 0) + ) + ) + (func $other1 (; 1 ;) (type $3) (param $i i32) + (drop + (i32.const 0) + ) + ) + (func $other2 (; 2 ;) (type $T) (result i32) + (i32.const 0) + ) + (func $other3 (; 3 ;) (type $S) (result i32) + (i32.const 0) + ) +) +(module + (type $S (func (result i32))) + (type $1 (func (param i32))) + (memory $0 0) + (func $keep2-similar-but-func-sig-differs (; 0 ;) (type $1) (param $i i32) + (drop + (i32.const 0) + ) + ) + (func $other2 (; 1 ;) (type $S) (result i32) + (i32.const 0) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (nop) + ) + (func $other (; 1 ;) (type $0) + (nop) + (nop) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (block $block0 + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (block $block0 + ) + ) + (func $other (; 1 ;) (type $0) + (block $block0 + (nop) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (block $block0 + (nop) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (block $block0 + (nop) + ) + ) + (func $other (; 1 ;) (type $0) + (block $block0 + (nop) + (unreachable) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (block $block0 + (nop) + ) + ) + (func $other (; 1 ;) (type $0) + (block $block0 + (unreachable) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase-since-block-names-do-not-matter (; 0 ;) (type $0) + (block $foo + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase-since-block-names-do-not-matter (; 0 ;) (type $0) + (block $foo + (br $foo) + (br_table $foo $foo + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (block $foo + (block $block + (drop + (i32.const 0) + ) + (br $foo) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (block $bar + (block $block + (drop + (i32.const 1) + ) + (br $bar) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (block $foo + (br_if $foo + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (block $bar + (br_if $bar + (i32.const 1) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (block $foo + (br_if $foo + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (block $foo + (br_table $foo $foo + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (block $bar + (br_table $bar $bar + (i32.const 1) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (loop $bar + (nop) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (block $foo (result i32) + (br_table $foo $foo + (i32.const 0) + (i32.const 0) + ) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (block $bar (result i32) + (br_table $bar $bar + (i32.const 0) + (i32.const 1) + ) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (block $foo + (block $bar + (br_table $foo $bar + (i32.const 0) + ) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (block $foo + (block $bar + (br_table $foo $bar + (i32.const 0) + ) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (block $bar + (block $foo + (br_table $foo $bar + (i32.const 0) + ) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (call $erase) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2-but-in-theory-we-could-erase (; 0 ;) (type $0) + (call $keep2-but-in-theory-we-could-erase) + ) + (func $other (; 1 ;) (type $0) + (call $other) + ) +) +(module + (type $FUNCSIG$v (func)) + (import "env" "i" (func $i)) + (import "env" "j" (func $j)) + (memory $0 0) + (func $erase (; 2 ;) (type $FUNCSIG$v) + (call $i) + ) +) +(module + (type $FUNCSIG$v (func)) + (import "env" "i" (func $i)) + (import "env" "j" (func $j)) + (memory $0 0) + (func $keep2 (; 2 ;) (type $FUNCSIG$v) + (call $i) + ) + (func $other (; 3 ;) (type $FUNCSIG$v) + (call $j) + ) +) +(module + (type $T (func)) + (table 2 2 anyfunc) + (elem (i32.const 0) $erase $erase) + (memory $0 0) + (func $erase (; 0 ;) (type $T) + (call_indirect (type $T) + (i32.const 0) + ) + ) +) +(module + (type $T (func)) + (table 2 2 anyfunc) + (elem (i32.const 0) $keep2 $other) + (memory $0 0) + (func $keep2 (; 0 ;) (type $T) + (call_indirect (type $T) + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $T) + (call_indirect (type $T) + (i32.const 1) + ) + ) +) +(module + (type $T (func)) + (type $S (func)) + (table 2 2 anyfunc) + (elem (i32.const 0) $keep2 $other) + (memory $0 0) + (func $keep2 (; 0 ;) (type $T) + (call_indirect (type $T) + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $T) + (call_indirect (type $S) + (i32.const 0) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase-even-locals-with-different-names (; 0 ;) (type $0) + (local $i i32) + (drop + (get_local $i) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (local $i i32) + (drop + (get_local $i) + ) + ) + (func $other (; 1 ;) (type $0) + (local $j i64) + (drop + (get_local $j) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase-even-locals-with-different-names (; 0 ;) (type $0) + (local $i i32) + (set_local $i + (i32.const 0) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (local $i i32) + (set_local $i + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $0) + (local $j i64) + (set_local $j + (i64.const 0) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (local $i i32) + (set_local $i + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $0) + (local $j i32) + (set_local $j + (i32.const 1) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $erase (; 0 ;) (type $0) + (drop + (i32.load + (i32.const 0) + ) + ) + (drop + (i32.load16_s offset=3 + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.load offset=3 + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (i32.load16_s offset=3 + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.load16_s offset=3 + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (i32.load16_s offset=3 align=1 + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.load16_s + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (i32.load16_s offset=3 + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.load16_s offset=3 + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (i32.load16_s offset=3 + (i32.const 1) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.load16_u offset=3 + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (i32.load16_s offset=3 + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $erase (; 0 ;) (type $0) + (i32.store + (i32.const 0) + (i32.const 100) + ) + (i32.store16 offset=3 + (i32.const 0) + (i32.const 100) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (i32.store offset=3 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (; 1 ;) (type $0) + (i32.store16 offset=3 + (i32.const 0) + (i32.const 100) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (i32.store16 offset=3 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (; 1 ;) (type $0) + (i32.store16 offset=3 align=1 + (i32.const 0) + (i32.const 100) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (i32.store16 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (; 1 ;) (type $0) + (i32.store16 offset=3 + (i32.const 0) + (i32.const 100) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (i32.store16 offset=3 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (; 1 ;) (type $0) + (i32.store16 offset=3 + (i32.const 1) + (i32.const 100) + ) + ) +) +(module + (type $0 (func)) + (memory $0 10) + (func $keep2 (; 0 ;) (type $0) + (i32.store16 offset=3 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (; 1 ;) (type $0) + (i32.store16 offset=3 + (i32.const 0) + (i32.const 101) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (i64.const 0) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (f32.const 0) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (f64.const 0) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (i64.const 0) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (i64.const 1) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (f32.const 0.10000000149011612) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (f32.const -0.10000000149011612) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (f64.const 0.1) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (f64.const 0.2) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (drop + (f32.abs + (f32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (f32.abs + (f32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (f32.abs + (f32.const 1) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (f32.abs + (f32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (f32.neg + (f32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 1) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (f32.add + (f32.const 1) + (f32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep2 (; 0 ;) (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (f32.sub + (f32.const 0) + (f32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep (; 0 ;) (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (select + (i32.const 1) + (i32.const 0) + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep (; 0 ;) (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (select + (i32.const 0) + (i32.const 2) + (i32.const 0) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep (; 0 ;) (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 3) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (return) + ) +) +(module + (type $0 (func (result i32))) + (memory $0 0) + (func $erase (; 0 ;) (type $0) (result i32) + (return + (i32.const 0) + ) + ) +) +(module + (type $0 (func (result i32))) + (memory $0 0) + (func $keep (; 0 ;) (type $0) (result i32) + (return + (i32.const 0) + ) + ) + (func $other (; 1 ;) (type $0) (result i32) + (return + (i32.const 1) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (drop + (current_memory) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $erase (; 0 ;) (type $0) + (drop + (grow_memory + (i32.const 10) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep (; 0 ;) (type $0) + (drop + (grow_memory + (i32.const 10) + ) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (grow_memory + (i32.const 11) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $keep (; 0 ;) (type $0) + (drop + (current_memory) + ) + ) + (func $other (; 1 ;) (type $0) + (drop + (grow_memory + (i32.const 10) + ) + ) + ) +) diff --git a/test/passes/duplicate-function-elimination.wast b/test/passes/duplicate-function-elimination_optimize-level=1.wast index b79032155..b79032155 100644 --- a/test/passes/duplicate-function-elimination.wast +++ b/test/passes/duplicate-function-elimination_optimize-level=1.wast diff --git a/test/passes/duplicate-function-elimination.txt b/test/passes/duplicate-function-elimination_optimize-level=2.txt index baf4fedf2..baf4fedf2 100644 --- a/test/passes/duplicate-function-elimination.txt +++ b/test/passes/duplicate-function-elimination_optimize-level=2.txt diff --git a/test/passes/duplicate-function-elimination_optimize-level=2.wast b/test/passes/duplicate-function-elimination_optimize-level=2.wast new file mode 100644 index 000000000..b79032155 --- /dev/null +++ b/test/passes/duplicate-function-elimination_optimize-level=2.wast @@ -0,0 +1,1221 @@ +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (nop) + ) + (func $other (type $0) + (nop) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (type $0) + (nop) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (type $0) + (drop + (i32.const 0) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (type $0) + (drop + (i32.const 1) + ) + ) +) +(module + (memory 0) + (start $other) + (type $0 (func)) + (export "keep2" $keep2) + (export "other" $other) + (table 3 3 anyfunc) + (elem (i32.const 0) $keep2 $other $caller) + (func $keep2 (type $0) + (nop) + ) + (func $other (type $0) + (nop) + ) + (func $caller (type $0) + (call $keep2) + (call $other) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2-after-two-passes (type $0) + (nop) + ) + (func $other (type $0) + (nop) + ) + (func $keep-caller (type $0) + (call $keep2-after-two-passes) + ) + (func $other-caller (type $0) + (call $other) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep-4 (type $0) + (nop) + ) + (func $other (type $0) + (unreachable) + ) + (func $keep-caller (type $0) + (call $keep-4) + ) + (func $other-caller (type $0) + (call $other) + ) +) +(module + (memory 0) + (type $T (func (result i32))) + (type $S (func (result i32))) + (type $2 (func)) + (type $3 (func (param i32))) + (func $keep4-similar-but-func-sig-differs (type $2) + (drop + (i32.const 0) + ) + ) + (func $other1 (type $3) (param $i i32) + (drop + (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))) + (type $1 (func (param i32))) + (func $keep2-similar-but-func-sig-differs (type $1) (param $i i32) + (drop + (i32.const 0) + ) + ) + (func $other1 (type $1) (param $i i32) + (drop + (i32.const 0) + ) + ) + (func $other2 (type $S) (result i32) + (i32.const 0) + ) + (func $other3 (type $S) (result i32) + (i32.const 0) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (nop) + ) + (func $other (type $0) + (nop) + (nop) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (block $block0 + ) + ) + (func $other (type $0) + (block $block0 + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (block $block0 + ) + ) + (func $other (type $0) + (block $block0 + (nop) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (block $block0 + (nop) + ) + ) + (func $other (type $0) + (block $block0 + (nop) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (block $block0 + (nop) + ) + ) + (func $other (type $0) + (block $block0 + (nop) + (unreachable) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (block $block0 + (nop) + ) + ) + (func $other (type $0) + (block $block0 + (unreachable) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase-since-block-names-do-not-matter (type $0) + (block $foo + ) + ) + (func $other (type $0) + (block $bar + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase-since-block-names-do-not-matter (type $0) + (block $foo + (br $foo) + (br_table $foo $foo + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (block $bar + (br $bar) + (br_table $bar $bar + (i32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (block $foo + (block + (drop + (i32.const 0) + ) + (br $foo) + ) + ) + ) + (func $other (type $0) + (block $bar + (block + (drop + (i32.const 1) + ) + (br $bar) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (block $foo + (br_if $foo + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (block $bar + (br_if $bar + (i32.const 1) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (block $foo + (br_if $foo + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (block $bar + (br_if $bar + (i32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (block $foo + (br_table $foo $foo + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (block $bar + (br_table $bar $bar + (i32.const 1) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (loop $bar + (nop) + ) + ) + (func $other (type $0) + (loop $sjc + (nop) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (block $foo (result i32) + (br_table $foo $foo + (i32.const 0) + (i32.const 0) + ) + ) + ) + ) + (func $other (type $0) + (drop + (block $bar (result i32) + (br_table $bar $bar + (i32.const 0) + (i32.const 1) + ) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (block $foo + (block $bar + (br_table $foo $bar + (i32.const 0) + ) + ) + ) + ) + (func $other (type $0) + (block $bar + (block $foo + (br_table $bar $foo + (i32.const 0) + ) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (block $foo + (block $bar + (br_table $foo $bar + (i32.const 0) + ) + ) + ) + ) + (func $other (type $0) + (block $bar + (block $foo + (br_table $foo $bar + (i32.const 0) + ) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (call $erase) + ) + (func $other (type $0) + (call $erase) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2-but-in-theory-we-could-erase (type $0) + (call $keep2-but-in-theory-we-could-erase) + ) + (func $other (type $0) + (call $other) + ) +) +(module + (memory 0) + (type $FUNCSIG$v (func)) + (import $i "env" "i") + (import $j "env" "j") + (func $erase (type $FUNCSIG$v) + (call $i) + ) + (func $other (type $FUNCSIG$v) + (call $i) + ) +) +(module + (memory 0) + (type $FUNCSIG$v (func)) + (import $i "env" "i") + (import $j "env" "j") + (func $keep2 (type $FUNCSIG$v) + (call $i) + ) + (func $other (type $FUNCSIG$v) + (call $j) + ) +) +(module + (memory 0) + (type $T (func)) + (table 2 2 anyfunc) + (elem (i32.const 0) $erase $other) + (func $erase (type $T) + (call_indirect (type $T) + (i32.const 0) + ) + ) + (func $other (type $T) + (call_indirect (type $T) + (i32.const 0) + ) + ) +) +(module + (memory 0) + (type $T (func)) + (table 2 2 anyfunc) + (elem (i32.const 0) $keep2 $other) + (func $keep2 (type $T) + (call_indirect (type $T) + (i32.const 0) + ) + ) + (func $other (type $T) + (call_indirect (type $T) + (i32.const 1) + ) + ) +) +(module + (memory 0) + (type $T (func)) + (type $S (func)) + (table 2 2 anyfunc) + (elem (i32.const 0) $keep2 $other) + (func $keep2 (type $T) + (call_indirect (type $T) + (i32.const 0) + ) + ) + (func $other (type $T) + (call_indirect (type $S) + (i32.const 0) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase-even-locals-with-different-names (type $0) + (local $i i32) + (drop + (get_local $i) + ) + ) + (func $other (type $0) + (local $j i32) + (drop + (get_local $j) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (local $i i32) + (drop + (get_local $i) + ) + ) + (func $other (type $0) + (local $j i64) + (drop + (get_local $j) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase-even-locals-with-different-names (type $0) + (local $i i32) + (set_local $i + (i32.const 0) + ) + ) + (func $other (type $0) + (local $j i32) + (set_local $j + (i32.const 0) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (local $i i32) + (set_local $i + (i32.const 0) + ) + ) + (func $other (type $0) + (local $j i64) + (set_local $j + (i64.const 0) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (local $i i32) + (set_local $i + (i32.const 0) + ) + ) + (func $other (type $0) + (local $j i32) + (set_local $j + (i32.const 1) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $erase (type $0) + (drop + (i32.load + (i32.const 0) + ) + ) + (drop + (i32.load16_s offset=3 align=2 + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (i32.load + (i32.const 0) + ) + ) + (drop + (i32.load16_s offset=3 align=2 + (i32.const 0) + ) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.load offset=3 + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (i32.load16_s offset=3 align=2 + (i32.const 0) + ) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.load16_s offset=3 + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (i32.load16_s offset=3 align=1 + (i32.const 0) + ) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.load16_s align=2 + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (i32.load16_s offset=3 align=2 + (i32.const 0) + ) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.load16_s offset=3 align=2 + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (i32.load16_s offset=3 align=2 + (i32.const 1) + ) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.load16_u offset=3 align=2 + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (i32.load16_s offset=3 align=2 + (i32.const 0) + ) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $erase (type $0) + (i32.store + (i32.const 0) + (i32.const 100) + ) + (i32.store16 offset=3 align=2 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (type $0) + (i32.store + (i32.const 0) + (i32.const 100) + ) + (i32.store16 offset=3 align=2 + (i32.const 0) + (i32.const 100) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (i32.store32 offset=3 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (type $0) + (i32.store16 offset=3 align=2 + (i32.const 0) + (i32.const 100) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (i32.store16 offset=3 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (type $0) + (i32.store16 offset=3 align=1 + (i32.const 0) + (i32.const 100) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (i32.store16 align=2 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (type $0) + (i32.store16 offset=3 align=2 + (i32.const 0) + (i32.const 100) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (i32.store16 offset=3 align=2 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (type $0) + (i32.store16 offset=3 align=2 + (i32.const 1) + (i32.const 100) + ) + ) +) +(module + (memory 10) + (type $0 (func)) + (func $keep2 (type $0) + (i32.store16 offset=3 align=2 + (i32.const 0) + (i32.const 100) + ) + ) + (func $other (type $0) + (i32.store16 offset=3 align=2 + (i32.const 0) + (i32.const 101) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (type $0) + (drop + (i64.const 0) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (type $0) + (drop + (f32.const 0) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i32.const 0) + ) + ) + (func $other (type $0) + (drop + (f64.const 0) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (i64.const 0) + ) + ) + (func $other (type $0) + (drop + (i64.const 1) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (f32.const 0.10000000149011612) + ) + ) + (func $other (type $0) + (drop + (f32.const -0.10000000149011612) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (f64.const 0.1) + ) + ) + (func $other (type $0) + (drop + (f64.const 0.2) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (drop + (f32.abs + (f32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (f32.abs + (f32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (f32.abs + (f32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (f32.abs + (f32.const 1) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (f32.abs + (f32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (f32.neg + (f32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 1) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (f32.add + (f32.const 1) + (f32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep2 (type $0) + (drop + (f32.add + (f32.const 0) + (f32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (f32.sub + (f32.const 0) + (f32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (select + (i32.const 1) + (i32.const 0) + (i32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (select + (i32.const 0) + (i32.const 2) + (i32.const 0) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + (func $other (type $0) + (drop + (select + (i32.const 0) + (i32.const 0) + (i32.const 3) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (return) + ) + (func $other (type $0) + (return) + ) +) +(module + (memory 0) + (type $0 (func (result i32))) + (func $erase (type $0) (result i32) + (return + (i32.const 0) + ) + ) + (func $other (type $0) (result i32) + (return + (i32.const 0) + ) + ) +) +(module + (memory 0) + (type $0 (func (result i32))) + (func $keep (type $0) (result i32) + (return + (i32.const 0) + ) + ) + (func $other (type $0) (result i32) + (return + (i32.const 1) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (drop + (current_memory) + ) + ) + (func $other (type $0) + (drop + (current_memory) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $erase (type $0) + (drop + (grow_memory + (i32.const 10) + ) + ) + ) + (func $other (type $0) + (drop + (grow_memory + (i32.const 10) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep (type $0) + (drop + (grow_memory + (i32.const 10) + ) + ) + ) + (func $other (type $0) + (drop + (grow_memory + (i32.const 11) + ) + ) + ) +) +(module + (memory 0) + (type $0 (func)) + (func $keep (type $0) + (drop + (current_memory) + ) + ) + (func $other (type $0) + (drop + (grow_memory + (i32.const 10) + ) + ) + ) +) diff --git a/test/passes/remove-unused-names_code-folding.txt b/test/passes/remove-unused-names_code-folding.txt index a37cbefbd..69c687862 100644 --- a/test/passes/remove-unused-names_code-folding.txt +++ b/test/passes/remove-unused-names_code-folding.txt @@ -1069,19 +1069,19 @@ (block (if (i32.const 1) - (br $folding-inner0) + (br $folding-inner1) ) (if (i32.const 1) - (br $folding-inner0) + (br $folding-inner1) ) (if (i32.const 1) - (br $folding-inner1) + (br $folding-inner0) ) (if (i32.const 1) - (br $folding-inner1) + (br $folding-inner0) ) ) (return) @@ -1098,7 +1098,7 @@ (nop) (nop) (drop - (i32.const 1) + (i32.const 2) ) (unreachable) ) @@ -1115,7 +1115,7 @@ (nop) (nop) (drop - (i32.const 2) + (i32.const 1) ) (unreachable) ) |