summaryrefslogtreecommitdiff
path: root/test/passes
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-11-05 16:38:34 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-11-05 16:49:24 -0700
commit5447c53b612c8d0f0d0902efe5053f2f81bd1595 (patch)
treee5f28cd40348a1d5de553e559b378066af2bcf63 /test/passes
parent13ce3488333f70607411eb504ea2046fe2dc7c6d (diff)
downloadbinaryen-5447c53b612c8d0f0d0902efe5053f2f81bd1595.tar.gz
binaryen-5447c53b612c8d0f0d0902efe5053f2f81bd1595.tar.bz2
binaryen-5447c53b612c8d0f0d0902efe5053f2f81bd1595.zip
add variants of simplify-locals with and without teeing and structural opts
Diffstat (limited to 'test/passes')
-rw-r--r--test/passes/simplify-locals-nostructure.txt38
-rw-r--r--test/passes/simplify-locals-nostructure.wast15
-rw-r--r--test/passes/simplify-locals-notee-nostructure.txt38
-rw-r--r--test/passes/simplify-locals-notee-nostructure.wast15
-rw-r--r--test/passes/simplify-locals-notee.txt34
-rw-r--r--test/passes/simplify-locals-notee.wast15
-rw-r--r--test/passes/simplify-locals.txt30
-rw-r--r--test/passes/simplify-locals.wast12
8 files changed, 197 insertions, 0 deletions
diff --git a/test/passes/simplify-locals-nostructure.txt b/test/passes/simplify-locals-nostructure.txt
new file mode 100644
index 000000000..d2f050181
--- /dev/null
+++ b/test/passes/simplify-locals-nostructure.txt
@@ -0,0 +1,38 @@
+(module
+ (type $0 (func))
+ (memory $0 0)
+ (func $contrast (type $0)
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (nop)
+ (if
+ (tee_local $x
+ (i32.const 1)
+ )
+ (nop)
+ )
+ (if
+ (get_local $x)
+ (nop)
+ )
+ (set_local $y
+ (if i32
+ (i32.const 2)
+ (i32.const 3)
+ (i32.const 4)
+ )
+ )
+ (drop
+ (get_local $y)
+ )
+ (set_local $z
+ (block $block i32
+ (i32.const 5)
+ )
+ )
+ (drop
+ (get_local $z)
+ )
+ )
+)
diff --git a/test/passes/simplify-locals-nostructure.wast b/test/passes/simplify-locals-nostructure.wast
new file mode 100644
index 000000000..fb938b8c5
--- /dev/null
+++ b/test/passes/simplify-locals-nostructure.wast
@@ -0,0 +1,15 @@
+(module
+ (func $contrast ;; check for tee and structure sinking
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (set_local $x (i32.const 1))
+ (if (get_local $x) (nop))
+ (if (get_local $x) (nop))
+ (set_local $y (if i32 (i32.const 2) (i32.const 3) (i32.const 4)))
+ (drop (get_local $y))
+ (set_local $z (block i32 (i32.const 5)))
+ (drop (get_local $z))
+ )
+)
+
diff --git a/test/passes/simplify-locals-notee-nostructure.txt b/test/passes/simplify-locals-notee-nostructure.txt
new file mode 100644
index 000000000..8c948dba0
--- /dev/null
+++ b/test/passes/simplify-locals-notee-nostructure.txt
@@ -0,0 +1,38 @@
+(module
+ (type $0 (func))
+ (memory $0 0)
+ (func $contrast (type $0)
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (set_local $x
+ (i32.const 1)
+ )
+ (if
+ (get_local $x)
+ (nop)
+ )
+ (if
+ (get_local $x)
+ (nop)
+ )
+ (set_local $y
+ (if i32
+ (i32.const 2)
+ (i32.const 3)
+ (i32.const 4)
+ )
+ )
+ (drop
+ (get_local $y)
+ )
+ (set_local $z
+ (block $block i32
+ (i32.const 5)
+ )
+ )
+ (drop
+ (get_local $z)
+ )
+ )
+)
diff --git a/test/passes/simplify-locals-notee-nostructure.wast b/test/passes/simplify-locals-notee-nostructure.wast
new file mode 100644
index 000000000..fb938b8c5
--- /dev/null
+++ b/test/passes/simplify-locals-notee-nostructure.wast
@@ -0,0 +1,15 @@
+(module
+ (func $contrast ;; check for tee and structure sinking
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (set_local $x (i32.const 1))
+ (if (get_local $x) (nop))
+ (if (get_local $x) (nop))
+ (set_local $y (if i32 (i32.const 2) (i32.const 3) (i32.const 4)))
+ (drop (get_local $y))
+ (set_local $z (block i32 (i32.const 5)))
+ (drop (get_local $z))
+ )
+)
+
diff --git a/test/passes/simplify-locals-notee.txt b/test/passes/simplify-locals-notee.txt
new file mode 100644
index 000000000..7d8967c5f
--- /dev/null
+++ b/test/passes/simplify-locals-notee.txt
@@ -0,0 +1,34 @@
+(module
+ (type $0 (func))
+ (memory $0 0)
+ (func $contrast (type $0)
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (set_local $x
+ (i32.const 1)
+ )
+ (if
+ (get_local $x)
+ (nop)
+ )
+ (if
+ (get_local $x)
+ (nop)
+ )
+ (nop)
+ (drop
+ (if i32
+ (i32.const 2)
+ (i32.const 3)
+ (i32.const 4)
+ )
+ )
+ (nop)
+ (drop
+ (block $block i32
+ (i32.const 5)
+ )
+ )
+ )
+)
diff --git a/test/passes/simplify-locals-notee.wast b/test/passes/simplify-locals-notee.wast
new file mode 100644
index 000000000..fb938b8c5
--- /dev/null
+++ b/test/passes/simplify-locals-notee.wast
@@ -0,0 +1,15 @@
+(module
+ (func $contrast ;; check for tee and structure sinking
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (set_local $x (i32.const 1))
+ (if (get_local $x) (nop))
+ (if (get_local $x) (nop))
+ (set_local $y (if i32 (i32.const 2) (i32.const 3) (i32.const 4)))
+ (drop (get_local $y))
+ (set_local $z (block i32 (i32.const 5)))
+ (drop (get_local $z))
+ )
+)
+
diff --git a/test/passes/simplify-locals.txt b/test/passes/simplify-locals.txt
index 36424193b..9175b3565 100644
--- a/test/passes/simplify-locals.txt
+++ b/test/passes/simplify-locals.txt
@@ -15,6 +15,36 @@
(import "env" "moddi" (func $___udivmoddi4 (param i32 i32 i32 i32 i32) (result i32)))
(import "env" "lp" (func $lp (param i32 i32) (result i32)))
(memory $0 256 256)
+ (func $contrast (type $FUNCSIG$v)
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (nop)
+ (if
+ (tee_local $x
+ (i32.const 1)
+ )
+ (nop)
+ )
+ (if
+ (get_local $x)
+ (nop)
+ )
+ (nop)
+ (drop
+ (if i32
+ (i32.const 2)
+ (i32.const 3)
+ (i32.const 4)
+ )
+ )
+ (nop)
+ (drop
+ (block $block i32
+ (i32.const 5)
+ )
+ )
+ )
(func $b0-yes (type $4) (param $i1 i32)
(local $x i32)
(local $y i32)
diff --git a/test/passes/simplify-locals.wast b/test/passes/simplify-locals.wast
index 06907a570..7f02a57c5 100644
--- a/test/passes/simplify-locals.wast
+++ b/test/passes/simplify-locals.wast
@@ -12,6 +12,18 @@
(import $_i64Subtract "env" "i64sub" (param i32 i32 i32 i32) (result i32))
(import $___udivmoddi4 "env" "moddi" (param i32 i32 i32 i32 i32) (result i32))
(import $lp "env" "lp" (param i32 i32) (result i32))
+ (func $contrast ;; check for tee and structure sinking
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (set_local $x (i32.const 1))
+ (if (get_local $x) (nop))
+ (if (get_local $x) (nop))
+ (set_local $y (if i32 (i32.const 2) (i32.const 3) (i32.const 4)))
+ (drop (get_local $y))
+ (set_local $z (block i32 (i32.const 5)))
+ (drop (get_local $z))
+ )
(func $b0-yes (type $4) (param $i1 i32)
(local $x i32)
(local $y i32)