summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-04-05 15:40:13 -0700
committerGitHub <noreply@github.com>2023-04-05 15:40:13 -0700
commit1b25a3cb040b3e082d0471192084008634cf834d (patch)
tree844661f19b34dc2962754bf02a56b56b6fd475f7 /test
parentc5603b6d315aa67f7c2b4b1d232813335c24aeb4 (diff)
downloadbinaryen-1b25a3cb040b3e082d0471192084008634cf834d.tar.gz
binaryen-1b25a3cb040b3e082d0471192084008634cf834d.tar.bz2
binaryen-1b25a3cb040b3e082d0471192084008634cf834d.zip
[Wasm GC] Handle another unreachability case in trapOnNull() (#5634)
This is the flip case of #5630
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/optimize-instructions-gc-tnh.wast42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/lit/passes/optimize-instructions-gc-tnh.wast b/test/lit/passes/optimize-instructions-gc-tnh.wast
index 5815f8e1f..7902c2161 100644
--- a/test/lit/passes/optimize-instructions-gc-tnh.wast
+++ b/test/lit/passes/optimize-instructions-gc-tnh.wast
@@ -817,6 +817,48 @@
)
)
+ ;; TNH: (func $select.unreachable.child.flip (type $none_=>_ref|$struct|) (result (ref $struct))
+ ;; TNH-NEXT: (select
+ ;; TNH-NEXT: (unreachable)
+ ;; TNH-NEXT: (ref.as_non_null
+ ;; TNH-NEXT: (ref.null none)
+ ;; TNH-NEXT: )
+ ;; TNH-NEXT: (i32.const 1)
+ ;; TNH-NEXT: )
+ ;; TNH-NEXT: )
+ ;; NO_TNH: (func $select.unreachable.child.flip (type $none_=>_ref|$struct|) (result (ref $struct))
+ ;; NO_TNH-NEXT: (select
+ ;; NO_TNH-NEXT: (block
+ ;; NO_TNH-NEXT: (drop
+ ;; NO_TNH-NEXT: (ref.as_non_null
+ ;; NO_TNH-NEXT: (ref.null none)
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: (unreachable)
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: (ref.as_non_null
+ ;; NO_TNH-NEXT: (ref.null none)
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: (i32.const 1)
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: )
+ (func $select.unreachable.child.flip (result (ref $struct))
+ ;; Flip case of the above.
+ (ref.cast $struct
+ (select (result (ref $struct))
+ (ref.cast $struct
+ (ref.as_non_null
+ (ref.null none)
+ )
+ )
+ (ref.as_non_null
+ (ref.null none)
+ )
+ (i32.const 1)
+ )
+ )
+ )
+
;; Helper functions.
;; TNH: (func $get-i32 (type $none_=>_i32) (result i32)