summaryrefslogtreecommitdiff
path: root/test/lit
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-10-18 09:17:50 -0700
committerGitHub <noreply@github.com>2024-10-18 09:17:50 -0700
commit795cf2895f713e8b05924e2a1e24a4d2de3ebcf5 (patch)
tree9864e2a9752e59cb0c2bb57efc8cf92725110dc4 /test/lit
parent245d9156d8bd52ce9bc50c554aa3a9cd42cd0e6b (diff)
downloadbinaryen-795cf2895f713e8b05924e2a1e24a4d2de3ebcf5.tar.gz
binaryen-795cf2895f713e8b05924e2a1e24a4d2de3ebcf5.tar.bz2
binaryen-795cf2895f713e8b05924e2a1e24a4d2de3ebcf5.zip
[EH] Add TryTable to StripEH (#7020)
Diffstat (limited to 'test/lit')
-rw-r--r--test/lit/passes/strip-eh.wast35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/lit/passes/strip-eh.wast b/test/lit/passes/strip-eh.wast
new file mode 100644
index 000000000..41c432088
--- /dev/null
+++ b/test/lit/passes/strip-eh.wast
@@ -0,0 +1,35 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
+;; RUN: wasm-opt %s -all --strip-eh -S -o - | filecheck %s
+
+;; Remove all EH instructions and tags. Converts 'throw's into 'unreachable's.
+
+(module
+ (tag $e-i32 (param i32))
+ (tag $e-f32 (param f32))
+
+ ;; CHECK: (func $throw-i32 (type $0)
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ (func $throw-i32
+ (throw $e-i32 (i32.const 0))
+ )
+ ;; CHECK: (func $throw-f32 (type $0)
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ (func $throw-f32
+ (throw $e-f32 (f32.const 0.0))
+ )
+
+ ;; CHECK: (func $try-catch (type $0)
+ ;; CHECK-NEXT: (block $out
+ ;; CHECK-NEXT: (call $throw-f32)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $try-catch
+ (block $out
+ (try_table (catch_all $out)
+ (call $throw-f32)
+ )
+ )
+ )
+)