summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/min.asm.js8
-rw-r--r--test/min.fromasm8
-rw-r--r--test/min.fromasm.imprecise8
-rw-r--r--test/min.fromasm.imprecise.no-opts10
-rw-r--r--test/min.fromasm.no-opts10
-rw-r--r--test/passes/remove-unused-brs.txt31
-rw-r--r--test/passes/remove-unused-brs.wast34
7 files changed, 108 insertions, 1 deletions
diff --git a/test/min.asm.js b/test/min.asm.js
index b72002f97..bef48f4c2 100644
--- a/test/min.asm.js
+++ b/test/min.asm.js
@@ -18,6 +18,8 @@ function (global, env, buffer) {
var hF32 = new global.Float32Array(buffer);
var hF64 = new global.Float64Array(buffer);
+ var M = 0; // tempRet
+
function floats(f) {
f = fr(f);
var t = fr(0);
@@ -40,7 +42,11 @@ function (global, env, buffer) {
function ctzzzz() {
return ctz32(0x1234) | 0;
}
+ function ub() {
+ ub(); // emterpreter assertions mode might add some code here
+ return M | 0;
+ }
- return { floats: floats };
+ return { floats: floats, getTempRet0: ub };
}
diff --git a/test/min.fromasm b/test/min.fromasm
index 54380a4ec..a912c2dad 100644
--- a/test/min.fromasm
+++ b/test/min.fromasm
@@ -7,6 +7,8 @@
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "floats" (func $floats))
+ (export "getTempRet0" (func $ub))
+ (global $M i32 (i32.const 0))
(func $floats (param $0 f32) (result f32)
(local $1 f32)
(f32.add
@@ -31,4 +33,10 @@
(func $ctzzzz (result i32)
(i32.const 2)
)
+ (func $ub (result i32)
+ (drop
+ (call $ub)
+ )
+ (get_global $M)
+ )
)
diff --git a/test/min.fromasm.imprecise b/test/min.fromasm.imprecise
index b07aba04e..a57298eef 100644
--- a/test/min.fromasm.imprecise
+++ b/test/min.fromasm.imprecise
@@ -6,6 +6,8 @@
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "floats" (func $floats))
+ (export "getTempRet0" (func $ub))
+ (global $M i32 (i32.const 0))
(func $floats (param $0 f32) (result f32)
(local $1 f32)
(f32.add
@@ -30,4 +32,10 @@
(func $ctzzzz (result i32)
(i32.const 2)
)
+ (func $ub (result i32)
+ (drop
+ (call $ub)
+ )
+ (get_global $M)
+ )
)
diff --git a/test/min.fromasm.imprecise.no-opts b/test/min.fromasm.imprecise.no-opts
index dd89a9eed..c0fcb1917 100644
--- a/test/min.fromasm.imprecise.no-opts
+++ b/test/min.fromasm.imprecise.no-opts
@@ -6,6 +6,8 @@
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "floats" (func $floats))
+ (export "getTempRet0" (func $ub))
+ (global $M i32 (i32.const 0))
(func $floats (param $f f32) (result f32)
(local $t f32)
(return
@@ -60,4 +62,12 @@
)
)
)
+ (func $ub (result i32)
+ (drop
+ (call $ub)
+ )
+ (return
+ (get_global $M)
+ )
+ )
)
diff --git a/test/min.fromasm.no-opts b/test/min.fromasm.no-opts
index dd89a9eed..c0fcb1917 100644
--- a/test/min.fromasm.no-opts
+++ b/test/min.fromasm.no-opts
@@ -6,6 +6,8 @@
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "floats" (func $floats))
+ (export "getTempRet0" (func $ub))
+ (global $M i32 (i32.const 0))
(func $floats (param $f f32) (result f32)
(local $t f32)
(return
@@ -60,4 +62,12 @@
)
)
)
+ (func $ub (result i32)
+ (drop
+ (call $ub)
+ )
+ (return
+ (get_global $M)
+ )
+ )
)
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt
index 94b214588..2cef4b5ac 100644
--- a/test/passes/remove-unused-brs.txt
+++ b/test/passes/remove-unused-brs.txt
@@ -4,6 +4,7 @@
(type $1 (func))
(type $2 (func (result i32)))
(type $3 (func (param i32 i32) (result i32)))
+ (type $4 (func (param i32 i32)))
(func $b0-yes (type $0) (param $i1 i32)
(block $topmost
)
@@ -843,4 +844,34 @@
(get_local $y)
)
)
+ (func $fuzz (type $4) (param $j i32) (param $g i32)
+ (block $label$break$c
+ (loop $label$continue$d
+ (block $label$break$d
+ (if
+ (i32.lt_s
+ (get_local $j)
+ (i32.const 2147483640)
+ )
+ (block $x
+ (block $y
+ (block $z
+ (br_if $x
+ (get_local $j)
+ )
+ )
+ )
+ )
+ (block $switch$26
+ )
+ )
+ (i32.store
+ (i32.const 5724)
+ (i32.const -254899267)
+ )
+ (br $label$continue$d)
+ )
+ )
+ )
+ )
)
diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast
index ecbcb6caa..995ab2d3a 100644
--- a/test/passes/remove-unused-brs.wast
+++ b/test/passes/remove-unused-brs.wast
@@ -760,4 +760,38 @@
)
(i32.add (get_local $x) (get_local $y))
)
+ (func $fuzz (param $j i32) (param $g i32)
+ (block $label$break$c
+ (loop $label$continue$d
+ (block $label$break$d
+ (if
+ (i32.lt_s
+ (get_local $j)
+ (i32.const 2147483640)
+ )
+ (block $x
+ (block $y
+ (block $z
+ (br_if $y
+ (get_local $j)
+ )
+ (br $x) ;; don't be confused by this
+ )
+ (nop) ;; get me to the store!
+ )
+ )
+ (block $switch$26
+ (nop)
+ )
+ )
+ (i32.store
+ (i32.const 5724)
+ (i32.const -254899267)
+ )
+ (br $label$continue$d)
+ )
+ )
+ )
+ )
)
+