summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/optimize-instructions.txt13
-rw-r--r--test/passes/optimize-instructions.wast16
-rw-r--r--test/passes/remove-unused-brs.txt40
-rw-r--r--test/passes/remove-unused-brs.wast18
-rw-r--r--test/passes/remove-unused-names_remove-unused-brs_vacuum.txt18
-rw-r--r--test/passes/remove-unused-names_remove-unused-brs_vacuum.wast18
-rw-r--r--test/passes/vacuum.txt4
-rw-r--r--test/passes/vacuum.wast23
8 files changed, 142 insertions, 8 deletions
diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt
index 8b42fd2ad..604c9c3ea 100644
--- a/test/passes/optimize-instructions.txt
+++ b/test/passes/optimize-instructions.txt
@@ -1993,4 +1993,17 @@
)
)
)
+ (func $sign-ext-1-and-ne (type $2) (result i32)
+ (select
+ (i32.ne
+ (i32.and
+ (call $sign-ext-1-and-ne)
+ (i32.const 2147483647)
+ )
+ (i32.const -2147483648)
+ )
+ (i32.const 2)
+ (i32.const 1)
+ )
+ )
)
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast
index 6d1fd60ed..cf8275412 100644
--- a/test/passes/optimize-instructions.wast
+++ b/test/passes/optimize-instructions.wast
@@ -2417,4 +2417,20 @@
)
)
)
+ (func $sign-ext-1-and-ne (result i32)
+ (select
+ (i32.ne
+ (i32.const 1333788672)
+ (i32.shr_s
+ (i32.shl
+ (call $sign-ext-1-and-ne)
+ (i32.const 1)
+ )
+ (i32.const 1)
+ )
+ )
+ (i32.const 2)
+ (i32.const 1)
+ )
+ )
)
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt
index 07b4575ce..417bd3728 100644
--- a/test/passes/remove-unused-brs.txt
+++ b/test/passes/remove-unused-brs.txt
@@ -5,6 +5,7 @@
(type $3 (func (param i32 i32) (result i32)))
(type $4 (func (param i32 i32)))
(type $5 (func (param f32 i32 f32 i32 i32 f64 f32) (result i32)))
+ (type $6 (func (param i32) (result i64)))
(memory $0 256 256)
(func $b0-yes (type $0) (param $i1 i32)
(block $topmost
@@ -539,11 +540,13 @@
(block $out59
(if
(i32.const 0)
- (block $block61
- (drop
- (i32.const 1)
+ (block
+ (block $block61
+ (drop
+ (i32.const 1)
+ )
+ (call $loops)
)
- (call $loops)
(br $in58)
)
(nop)
@@ -584,11 +587,13 @@
(block $out69
(if
(i32.const 0)
- (block $block71
- (drop
- (i32.const 1)
+ (block
+ (block $block71
+ (drop
+ (i32.const 1)
+ )
+ (call $loops)
)
- (call $loops)
(drop
(i32.const 102)
)
@@ -1011,4 +1016,23 @@
(i32.const 1935947830)
)
)
+ (func $unexitable-loops-result (type $6) (param $0 i32) (result i64)
+ (loop $label$0
+ (loop $label$1
+ (br_if $label$0
+ (i32.load8_s
+ (i32.const 201460482)
+ )
+ )
+ (block
+ (block $label$3
+ (br_if $label$1
+ (get_local $0)
+ )
+ )
+ (br $label$1)
+ )
+ )
+ )
+ )
)
diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast
index 04ebdac33..d694bd4d0 100644
--- a/test/passes/remove-unused-brs.wast
+++ b/test/passes/remove-unused-brs.wast
@@ -901,5 +901,23 @@
(i32.const 1935947830)
)
)
+ (func $unexitable-loops-result (param $0 i32) (result i64)
+ (loop $label$0
+ (loop $label$1
+ (if
+ (i32.load8_s
+ (i32.const 201460482)
+ )
+ (br $label$0)
+ (block $label$3
+ (br_if $label$3
+ (get_local $0)
+ )
+ )
+ )
+ (br $label$1)
+ )
+ )
+ )
)
diff --git a/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt b/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt
index d8ce15491..4eeb1ee97 100644
--- a/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt
+++ b/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt
@@ -22,6 +22,7 @@
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$id (func (param f64) (result i32)))
+ (type $23 (func (param i32) (result i64)))
(import "env" "DYNAMICTOP_PTR" (global $import$0 i32))
(import "env" "tempDoublePtr" (global $import$1 i32))
(import "env" "ABORT" (global $import$2 i32))
@@ -113,4 +114,21 @@
(func $23 (type $0) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(unreachable)
)
+ (func $unexitable-loops-result (type $23) (param $0 i32) (result i64)
+ (loop $label$0
+ (loop $label$1
+ (br_if $label$0
+ (i32.load8_s
+ (i32.const 201460482)
+ )
+ )
+ (block
+ (br_if $label$1
+ (get_local $0)
+ )
+ (br $label$1)
+ )
+ )
+ )
+ )
)
diff --git a/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast b/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast
index 5a0ec5114..12f664a36 100644
--- a/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast
+++ b/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast
@@ -127,5 +127,23 @@
(func $23 (param i32) (param i32) (param i32) (result i32)
(unreachable)
)
+ (func $unexitable-loops-result (param $0 i32) (result i64)
+ (loop $label$0
+ (loop $label$1
+ (if
+ (i32.load8_s
+ (i32.const 201460482)
+ )
+ (br $label$0)
+ (block $label$3
+ (br_if $label$3
+ (get_local $0)
+ )
+ )
+ )
+ (br $label$1)
+ )
+ )
+ )
)
diff --git a/test/passes/vacuum.txt b/test/passes/vacuum.txt
index f3b06af1a..011fb99f5 100644
--- a/test/passes/vacuum.txt
+++ b/test/passes/vacuum.txt
@@ -301,4 +301,8 @@
)
)
)
+ (func $nop-if-type-changes (type $0)
+ (local $0 i32)
+ (nop)
+ )
)
diff --git a/test/passes/vacuum.wast b/test/passes/vacuum.wast
index db4bf6749..3b5b22e9c 100644
--- a/test/passes/vacuum.wast
+++ b/test/passes/vacuum.wast
@@ -637,4 +637,27 @@
(i32.const 1579493952)
)
)
+ (func $nop-if-type-changes (type $0)
+ (local $0 i32)
+ (block $label$0
+ (if
+ (i32.eqz
+ (get_local $0)
+ )
+ (block $label$1
+ (block
+ (if ;; we nop this if, which has a type change for block $label$1, no more brs to it
+ (i32.const 0)
+ (br_if $label$1
+ (i32.const 1717966400)
+ )
+ )
+ (drop
+ (br $label$0)
+ )
+ )
+ )
+ )
+ )
+ )
)