summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/simplify-locals.txt22
-rw-r--r--test/passes/simplify-locals.wast29
2 files changed, 51 insertions, 0 deletions
diff --git a/test/passes/simplify-locals.txt b/test/passes/simplify-locals.txt
new file mode 100644
index 000000000..b743ea528
--- /dev/null
+++ b/test/passes/simplify-locals.txt
@@ -0,0 +1,22 @@
+(module
+ (type $0 (func (result i32)))
+ (func $sink-from-inside (; 0 ;) (type $0) (result i32)
+ (local $0 i32)
+ (local $1 i32)
+ (local $2 i32)
+ (nop)
+ (i32.and
+ (select
+ (i32.const 0)
+ (i32.const 1)
+ (i32.const 1)
+ )
+ (block $block (result i32)
+ (nop)
+ (nop)
+ (nop)
+ (i32.const 1)
+ )
+ )
+ )
+)
diff --git a/test/passes/simplify-locals.wast b/test/passes/simplify-locals.wast
new file mode 100644
index 000000000..3208b76de
--- /dev/null
+++ b/test/passes/simplify-locals.wast
@@ -0,0 +1,29 @@
+(module
+ (func $sink-from-inside (result i32)
+ (local $0 i32)
+ (local $1 i32)
+ (local $2 i32)
+ (local.set $2
+ (block (result i32)
+ (local.set $0
+ (i32.const 1)
+ )
+ (drop
+ (local.get $0)
+ )
+ (local.set $1 ;; after we sink this, must be careful about sinking the parent, to not reorder other things badly
+ (select
+ (i32.const 0)
+ (i32.const 1)
+ (local.get $0)
+ )
+ )
+ (i32.const 1)
+ )
+ )
+ (i32.and
+ (local.get $1)
+ (local.get $2)
+ )
+ )
+)