summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/gufa-refs.wast54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast
index ddd10e7f9..d8fb51e50 100644
--- a/test/lit/passes/gufa-refs.wast
+++ b/test/lit/passes/gufa-refs.wast
@@ -938,6 +938,8 @@
;; CHECK: (type $none_=>_none (func_subtype func))
+ ;; CHECK: (elem declare func $func)
+
;; CHECK: (func $func (type $none_=>_none)
;; CHECK-NEXT: (local $child (ref null $child))
;; CHECK-NEXT: (local $parent (ref null $parent))
@@ -977,6 +979,35 @@
;; CHECK-NEXT: (ref.null $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block
+ ;; CHECK-NEXT: (block
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block $parent (result (ref $parent))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block (result (ref $none_=>_none))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (br_on_cast_static $parent $parent
+ ;; CHECK-NEXT: (ref.func $func)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (ref.func $func)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $func
(local $child (ref null $child))
@@ -1013,6 +1044,29 @@
(local.get $parent)
)
)
+ ;; A ref.func is cast to a struct type, and then we read from that. The cast
+ ;; will trap at runtime, of course; for here, we should not error and also
+ ;; we can optimize these to unreachables. atm we filter out trapping
+ ;; contents in ref.cast, but not br_on_cast, so test both.
+ (drop
+ (struct.get $parent 0
+ (ref.cast_static $parent
+ (ref.func $func)
+ )
+ )
+ )
+ (drop
+ (struct.get $parent 0
+ (block $parent (result (ref $parent))
+ (drop
+ (br_on_cast_static $parent $parent
+ (ref.func $func)
+ )
+ )
+ (unreachable)
+ )
+ )
+ )
)
;; CHECK: (func $nulls (type $none_=>_none)