diff options
Diffstat (limited to 'test/passes')
-rw-r--r-- | test/passes/func-metrics.txt | 2 | ||||
-rw-r--r-- | test/passes/simplify-globals_enable-mutable-globals.txt | 53 | ||||
-rw-r--r-- | test/passes/simplify-globals_enable-mutable-globals.wast | 37 |
3 files changed, 91 insertions, 1 deletions
diff --git a/test/passes/func-metrics.txt b/test/passes/func-metrics.txt index fd8d949bd..fa4857b56 100644 --- a/test/passes/func-metrics.txt +++ b/test/passes/func-metrics.txt @@ -235,7 +235,7 @@ func: 0 [vars] : 0 global.get : 1 export: stackSave (0) - [removable-bytes-without-it]: 74 + [removable-bytes-without-it]: 66 [total] : 0 (module (type $0 (func (result i32))) diff --git a/test/passes/simplify-globals_enable-mutable-globals.txt b/test/passes/simplify-globals_enable-mutable-globals.txt new file mode 100644 index 000000000..0b3ce2201 --- /dev/null +++ b/test/passes/simplify-globals_enable-mutable-globals.txt @@ -0,0 +1,53 @@ +(module + (type $0 (func)) + (import "env" "global-1" (global $g1 i32)) + (global $g2 i32 (global.get $g1)) + (func $foo (; 0 ;) (type $0) + (drop + (global.get $g1) + ) + (drop + (global.get $g1) + ) + ) +) +(module + (type $0 (func)) + (import "env" "global-1" (global $g1 i32)) + (global $g2 i32 (global.get $g1)) + (global $g3 i32 (global.get $g2)) + (global $g4 i32 (global.get $g3)) + (func $foo (; 0 ;) (type $0) + (drop + (global.get $g1) + ) + (drop + (global.get $g1) + ) + (drop + (global.get $g1) + ) + (drop + (global.get $g1) + ) + ) +) +(module + (import "env" "global-1" (global $g1 (mut i32))) + (global $g2 i32 (global.get $g1)) +) +(module + (type $0 (func)) + (import "env" "global-1" (global $g1 i32)) + (global $g2 (mut i32) (global.get $g1)) + (func $foo (; 0 ;) (type $0) + (global.set $g2 + (unreachable) + ) + ) +) +(module + (import "env" "global-1" (global $g1 (mut i32))) + (global $g2 (mut i32) (global.get $g1)) + (export "global-2" (global $g2)) +) diff --git a/test/passes/simplify-globals_enable-mutable-globals.wast b/test/passes/simplify-globals_enable-mutable-globals.wast new file mode 100644 index 000000000..599f7e6ff --- /dev/null +++ b/test/passes/simplify-globals_enable-mutable-globals.wast @@ -0,0 +1,37 @@ +(module + (import "env" "global-1" (global $g1 i32)) + (global $g2 (mut i32) (global.get $g1)) + (func $foo + (drop (global.get $g1)) + (drop (global.get $g2)) + ) +) +(module + (import "env" "global-1" (global $g1 i32)) + (global $g2 (mut i32) (global.get $g1)) + (global $g3 (mut i32) (global.get $g2)) + (global $g4 (mut i32) (global.get $g3)) + (func $foo + (drop (global.get $g1)) + (drop (global.get $g2)) + (drop (global.get $g3)) + (drop (global.get $g4)) + ) +) +(module + (import "env" "global-1" (global $g1 (mut i32))) + (global $g2 (mut i32) (global.get $g1)) +) +(module + (import "env" "global-1" (global $g1 i32)) + (global $g2 (mut i32) (global.get $g1)) + (func $foo + (global.set $g2 (unreachable)) + ) +) +(module + (import "env" "global-1" (global $g1 (mut i32))) + (global $g2 (mut i32) (global.get $g1)) + (export "global-2" (global $g2)) +) + |