summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/dce_all-features.txt (renamed from test/passes/dce.txt)31
-rw-r--r--test/passes/dce_all-features.wast (renamed from test/passes/dce.wast)34
2 files changed, 65 insertions, 0 deletions
diff --git a/test/passes/dce.txt b/test/passes/dce_all-features.txt
index 6c7b6ca3a..f9e1b70a4 100644
--- a/test/passes/dce.txt
+++ b/test/passes/dce_all-features.txt
@@ -501,3 +501,34 @@
)
)
)
+(module
+ (type $FUNCSIG$v (func))
+ (func $foo (; 0 ;) (type $FUNCSIG$v)
+ (nop)
+ )
+ (func $try_unreachable (; 1 ;) (type $FUNCSIG$v)
+ (try
+ (unreachable)
+ (catch
+ )
+ )
+ (call $foo)
+ )
+ (func $catch_unreachable (; 2 ;) (type $FUNCSIG$v)
+ (try
+ (nop)
+ (catch
+ (unreachable)
+ )
+ )
+ (call $foo)
+ )
+ (func $both_unreachable (; 3 ;) (type $FUNCSIG$v)
+ (try
+ (unreachable)
+ (catch
+ (unreachable)
+ )
+ )
+ )
+)
diff --git a/test/passes/dce.wast b/test/passes/dce_all-features.wast
index 0d3b04557..c6fe0d5d0 100644
--- a/test/passes/dce.wast
+++ b/test/passes/dce_all-features.wast
@@ -734,3 +734,37 @@
)
)
+;; Exception handling instruction support
+;; If either try body or catch body is reachable, the whole try construct is
+;; reachable
+(module
+ (func $foo)
+
+ (func $try_unreachable
+ (try
+ (unreachable)
+ (catch
+ )
+ )
+ (call $foo) ;; shouldn't be dce'd
+ )
+
+ (func $catch_unreachable
+ (try
+ (catch
+ (unreachable)
+ )
+ )
+ (call $foo) ;; shouldn't be dce'd
+ )
+
+ (func $both_unreachable
+ (try
+ (unreachable)
+ (catch
+ (unreachable)
+ )
+ )
+ (call $foo) ;; should be dce'd
+ )
+)