summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/rse_all-features.txt (renamed from test/passes/rse.txt)125
-rw-r--r--test/passes/rse_all-features.wast (renamed from test/passes/rse.wast)79
2 files changed, 204 insertions, 0 deletions
diff --git a/test/passes/rse.txt b/test/passes/rse_all-features.txt
index 6eb7996bf..82dc115ac 100644
--- a/test/passes/rse.txt
+++ b/test/passes/rse_all-features.txt
@@ -3,6 +3,7 @@
(type $i32_=>_none (func (param i32)))
(type $i32_i32_=>_none (func (param i32 i32)))
(type $i32_f64_=>_none (func (param i32 f64)))
+ (event $e (attr 0) (param i32))
(func $basic (; 0 ;) (param $x i32) (param $y f64)
(local $a f32)
(local $b i64)
@@ -459,4 +460,128 @@
)
)
)
+ (func $try1 (; 19 ;)
+ (local $x i32)
+ (try
+ (nop)
+ (catch
+ (drop
+ (exnref.pop)
+ )
+ (local.set $x
+ (i32.const 1)
+ )
+ )
+ )
+ (local.set $x
+ (i32.const 1)
+ )
+ )
+ (func $try2 (; 20 ;)
+ (local $x i32)
+ (try
+ (block $block
+ (throw $e
+ (i32.const 0)
+ )
+ (local.set $x
+ (i32.const 1)
+ )
+ )
+ (catch
+ (drop
+ (exnref.pop)
+ )
+ )
+ )
+ (local.set $x
+ (i32.const 1)
+ )
+ )
+ (func $try3 (; 21 ;)
+ (local $x i32)
+ (try
+ (throw $e
+ (i32.const 0)
+ )
+ (catch
+ (drop
+ (exnref.pop)
+ )
+ (local.set $x
+ (i32.const 1)
+ )
+ )
+ )
+ (drop
+ (i32.const 1)
+ )
+ )
+ (func $foo (; 22 ;)
+ (nop)
+ )
+ (func $try4 (; 23 ;)
+ (local $x i32)
+ (try
+ (block $block
+ (call $foo)
+ (local.set $x
+ (i32.const 1)
+ )
+ )
+ (catch
+ (drop
+ (exnref.pop)
+ )
+ )
+ )
+ (local.set $x
+ (i32.const 1)
+ )
+ )
+ (func $try5 (; 24 ;)
+ (local $x i32)
+ (try
+ (block $block
+ (local.set $x
+ (i32.const 1)
+ )
+ (call $foo)
+ )
+ (catch
+ (drop
+ (exnref.pop)
+ )
+ )
+ )
+ (drop
+ (i32.const 1)
+ )
+ )
+ (func $nested-try (; 25 ;)
+ (local $x i32)
+ (try
+ (try
+ (throw $e
+ (i32.const 0)
+ )
+ (catch
+ (rethrow
+ (exnref.pop)
+ )
+ )
+ )
+ (catch
+ (drop
+ (exnref.pop)
+ )
+ (local.set $x
+ (i32.const 1)
+ )
+ )
+ )
+ (drop
+ (i32.const 1)
+ )
+ )
)
diff --git a/test/passes/rse.wast b/test/passes/rse_all-features.wast
index 22d13c491..09b0d720d 100644
--- a/test/passes/rse.wast
+++ b/test/passes/rse_all-features.wast
@@ -277,5 +277,84 @@
)
)
)
+
+ (event $e (attr 0) (param i32))
+ (func $try1
+ (local $x i32)
+ (try
+ (catch
+ (drop (exnref.pop))
+ (local.set $x (i32.const 1))
+ )
+ )
+ (local.set $x (i32.const 1)) ;; should NOT be dropped
+ )
+ (func $try2
+ (local $x i32)
+ (try
+ (block
+ (throw $e (i32.const 0))
+ (local.set $x (i32.const 1))
+ )
+ (catch
+ (drop (exnref.pop))
+ )
+ )
+ (local.set $x (i32.const 1)) ;; should NOT be dropped
+ )
+ (func $try3
+ (local $x i32)
+ (try
+ (throw $e (i32.const 0))
+ (catch
+ (drop (exnref.pop))
+ (local.set $x (i32.const 1))
+ )
+ )
+ (local.set $x (i32.const 1)) ;; should be dropped
+ )
+ (func $foo)
+ (func $try4
+ (local $x i32)
+ (try
+ (block
+ (call $foo)
+ (local.set $x (i32.const 1))
+ )
+ (catch
+ (drop (exnref.pop))
+ )
+ )
+ (local.set $x (i32.const 1)) ;; should NOT be dropped
+ )
+ (func $try5
+ (local $x i32)
+ (try
+ (block
+ (local.set $x (i32.const 1))
+ (call $foo)
+ )
+ (catch
+ (drop (exnref.pop))
+ )
+ )
+ (local.set $x (i32.const 1)) ;; should be dropped
+ )
+ (func $nested-try
+ (local $x i32)
+ (try
+ (try
+ (throw $e (i32.const 0))
+ (catch
+ (rethrow (exnref.pop))
+ )
+ )
+ (catch
+ (drop (exnref.pop))
+ (local.set $x (i32.const 1))
+ )
+ )
+ (local.set $x (i32.const 1)) ;; should be dropped
+ )
)