summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/signature-refining.wast46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/lit/passes/signature-refining.wast b/test/lit/passes/signature-refining.wast
index 19558d997..8e5d3b75e 100644
--- a/test/lit/passes/signature-refining.wast
+++ b/test/lit/passes/signature-refining.wast
@@ -674,3 +674,49 @@
(nop)
)
)
+
+(module
+ ;; CHECK: (type $ref|${}|_i32_=>_none (func_subtype (param (ref ${}) i32) func))
+
+ ;; CHECK: (type ${} (struct_subtype data))
+ (type ${} (struct_subtype data))
+
+ ;; CHECK: (func $foo (type $ref|${}|_i32_=>_none) (param $ref (ref ${})) (param $i32 i32)
+ ;; CHECK-NEXT: (local $2 eqref)
+ ;; CHECK-NEXT: (local.set $2
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (block
+ ;; CHECK-NEXT: (call $foo
+ ;; CHECK-NEXT: (block $block
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $2
+ ;; CHECK-NEXT: (ref.null eq)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $foo (param $ref eqref) (param $i32 i32)
+ (call $foo
+ ;; The only reference to the ${} type is in this block signature. Even
+ ;; this will go away in the internal ReFinalize (which makes the block
+ ;; type unreachable).
+ (block (result (ref ${}))
+ (unreachable)
+ )
+ (i32.const 0)
+ )
+ ;; Write something of type eqref into $ref. When we refine the type of the
+ ;; parameter from eqref to ${} we must do something here, as we can no
+ ;; longer just write this (ref.null eq) into a parameter of the more
+ ;; refined type. While doing so, we must not be confused by the fact that
+ ;; the only mention of ${} in the original module gets removed during our
+ ;; processing, as mentioned in the earlier comment. This is a regression
+ ;; test for a crash because of that.
+ (local.set $ref
+ (ref.null eq)
+ )
+ )
+)