summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2020-05-11 10:50:11 -0700
committerGitHub <noreply@github.com>2020-05-11 10:50:11 -0700
commit91ec2ee5bedefc4736fcda78ae39298846aeeb41 (patch)
treefd7c34a65f7c2273bad64d93f554a7aedca5be60 /test
parent2c30ee408a72f5403fddeba8b4b856437c711727 (diff)
downloadbinaryen-91ec2ee5bedefc4736fcda78ae39298846aeeb41.tar.gz
binaryen-91ec2ee5bedefc4736fcda78ae39298846aeeb41.tar.bz2
binaryen-91ec2ee5bedefc4736fcda78ae39298846aeeb41.zip
Handle throw and rethrow in DCE (#2844)
This adds missing handlings for `throw` and `rethrow` in DCE. They should set `reachable` variable to `false`, like other branches.
Diffstat (limited to 'test')
-rw-r--r--test/passes/dce_all-features.txt10
-rw-r--r--test/passes/dce_all-features.wast35
2 files changed, 45 insertions, 0 deletions
diff --git a/test/passes/dce_all-features.txt b/test/passes/dce_all-features.txt
index 47b2e6cc2..e5af0bff9 100644
--- a/test/passes/dce_all-features.txt
+++ b/test/passes/dce_all-features.txt
@@ -503,6 +503,7 @@
)
(module
(type $none_=>_none (func))
+ (event $e (attr 0) (param))
(func $foo
(nop)
)
@@ -531,6 +532,15 @@
)
)
)
+ (func $throw
+ (throw $e
+ )
+ )
+ (func $rethrow
+ (rethrow
+ (ref.null)
+ )
+ )
)
(module
(type $none_=>_none (func))
diff --git a/test/passes/dce_all-features.wast b/test/passes/dce_all-features.wast
index cfdc58bbb..98b2b0ecd 100644
--- a/test/passes/dce_all-features.wast
+++ b/test/passes/dce_all-features.wast
@@ -739,6 +739,7 @@
;; reachable
(module
(func $foo)
+ (event $e (attr 0))
(func $try_unreachable
(try
@@ -767,6 +768,40 @@
)
(call $foo) ;; should be dce'd
)
+
+ (func $throw
+ (drop
+ (block $label$0 (result nullref)
+ (if
+ (i32.clz
+ (block $label$1 (result i32)
+ (throw $e)
+ )
+ )
+ (nop)
+ )
+ (ref.null)
+ )
+ )
+ )
+
+ (func $rethrow
+ (drop
+ (block $label$0 (result nullref)
+ (if
+ (i32.clz
+ (block $label$1 (result i32)
+ (rethrow
+ (ref.null)
+ )
+ )
+ )
+ (nop)
+ )
+ (ref.null)
+ )
+ )
+ )
)
;; Push-pop