summaryrefslogtreecommitdiff
path: root/test/passes/simplify-locals-nonesting.txt
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-04-30 19:40:30 -0700
committerGitHub <noreply@github.com>2018-04-30 19:40:30 -0700
commite020f4a2cb44fcbfd56c95a4a097f08cddc8367e (patch)
tree4bc1ff221fd7a0bad812c065bb205ee2fa870e30 /test/passes/simplify-locals-nonesting.txt
parentec426c6b8ba87c5c5107ed30497ad13252dd3258 (diff)
downloadbinaryen-e020f4a2cb44fcbfd56c95a4a097f08cddc8367e.tar.gz
binaryen-e020f4a2cb44fcbfd56c95a4a097f08cddc8367e.tar.bz2
binaryen-e020f4a2cb44fcbfd56c95a4a097f08cddc8367e.zip
--simplify-locals-nonesting (#1525)
Add a version of simplify-locals which does not create nesting. This keeps the IR flat (in the sense of --flatten). Also refactor simpify-locals to be a template, so the various modes are all template parameters.
Diffstat (limited to 'test/passes/simplify-locals-nonesting.txt')
-rw-r--r--test/passes/simplify-locals-nonesting.txt202
1 files changed, 202 insertions, 0 deletions
diff --git a/test/passes/simplify-locals-nonesting.txt b/test/passes/simplify-locals-nonesting.txt
new file mode 100644
index 000000000..903c97df5
--- /dev/null
+++ b/test/passes/simplify-locals-nonesting.txt
@@ -0,0 +1,202 @@
+(module
+ (type $0 (func (param i64 i64 i64) (result i32)))
+ (type $1 (func (param i32) (result i32)))
+ (func $figure-1a (; 0 ;) (type $0) (param $a i64) (param $x i64) (param $y i64) (result i32)
+ (local $i i32)
+ (local $j i32)
+ (local $r i32)
+ (local $6 i64)
+ (local $7 i64)
+ (local $8 i32)
+ (local $9 i64)
+ (local $10 i64)
+ (local $11 i32)
+ (local $12 i32)
+ (local $13 i32)
+ (local $14 i32)
+ (local $15 i32)
+ (local $16 i32)
+ (local $17 i32)
+ (block $block
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (set_local $12
+ (i64.eq
+ (get_local $a)
+ (get_local $x)
+ )
+ )
+ (set_local $13
+ (i64.ne
+ (get_local $a)
+ (get_local $y)
+ )
+ )
+ (nop)
+ (nop)
+ (nop)
+ (set_local $15
+ (i32.and
+ (get_local $12)
+ (get_local $13)
+ )
+ )
+ (return
+ (get_local $15)
+ )
+ (unreachable)
+ )
+ (nop)
+ (return
+ (get_local $16)
+ )
+ )
+ (func $figure-1b (; 1 ;) (type $0) (param $a i64) (param $x i64) (param $y i64) (result i32)
+ (local $i i32)
+ (local $j i32)
+ (local $r i32)
+ (local $6 i64)
+ (local $7 i64)
+ (local $8 i32)
+ (local $9 i64)
+ (local $10 i64)
+ (local $11 i32)
+ (local $12 i64)
+ (local $13 i64)
+ (local $14 i32)
+ (local $15 i32)
+ (local $16 i32)
+ (local $17 i32)
+ (local $18 i32)
+ (block $block
+ (nop)
+ (nop)
+ (set_local $8
+ (i64.lt_s
+ (get_local $x)
+ (get_local $y)
+ )
+ )
+ (if
+ (get_local $8)
+ (block $block0
+ (block $block1
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (nop)
+ (set_local $15
+ (i64.eq
+ (get_local $a)
+ (get_local $x)
+ )
+ )
+ (set_local $16
+ (i64.ne
+ (get_local $a)
+ (get_local $y)
+ )
+ )
+ (nop)
+ (nop)
+ (nop)
+ (set_local $18
+ (i32.and
+ (get_local $15)
+ (get_local $16)
+ )
+ )
+ (return
+ (get_local $18)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (block $block2
+ (unreachable)
+ (unreachable)
+ )
+ )
+ )
+ (unreachable)
+ )
+ (func $figure-3-if (; 2 ;) (type $1) (param $x i32) (result i32)
+ (local $1 i32)
+ (local $2 i32)
+ (local $3 i32)
+ (local $4 i32)
+ (local $5 i32)
+ (local $6 i32)
+ (local $7 i32)
+ (local $8 i32)
+ (local $9 i32)
+ (local $10 i32)
+ (block $block
+ (block $block3
+ (nop)
+ (set_local $2
+ (i32.and
+ (get_local $x)
+ (i32.const 1)
+ )
+ )
+ (if
+ (get_local $2)
+ (block $block4
+ (nop)
+ (nop)
+ (set_local $x
+ (i32.add
+ (get_local $x)
+ (i32.const 1)
+ )
+ )
+ (nop)
+ )
+ (block $block5
+ (nop)
+ (nop)
+ (set_local $x
+ (i32.add
+ (get_local $x)
+ (i32.const 2)
+ )
+ )
+ (nop)
+ )
+ )
+ )
+ (nop)
+ (nop)
+ (set_local $8
+ (i32.and
+ (get_local $x)
+ (i32.const 1)
+ )
+ )
+ (return
+ (get_local $8)
+ )
+ (unreachable)
+ )
+ (nop)
+ (return
+ (get_local $9)
+ )
+ )
+)