summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-05-01 12:25:06 -0700
committerGitHub <noreply@github.com>2023-05-01 12:25:06 -0700
commit6fee09ae5734f0e16b7119649ef20818997654a3 (patch)
tree462779d6f5eaaef33ab684f4812f2d0aa7062e50 /test
parente87d3a455580b20fa71abf5fe58b6d62cb41980d (diff)
downloadbinaryen-6fee09ae5734f0e16b7119649ef20818997654a3.tar.gz
binaryen-6fee09ae5734f0e16b7119649ef20818997654a3.tar.bz2
binaryen-6fee09ae5734f0e16b7119649ef20818997654a3.zip
[Wasm GC] Always refinalize in SignatureRefining (#5694)
We used to refine only for result changes, but param changes can also lead to opportunities.
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/signature-refining.wast38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/lit/passes/signature-refining.wast b/test/lit/passes/signature-refining.wast
index 11bc84f35..996adf658 100644
--- a/test/lit/passes/signature-refining.wast
+++ b/test/lit/passes/signature-refining.wast
@@ -850,3 +850,41 @@
)
)
)
+
+(module
+ ;; CHECK: (rec
+ ;; CHECK-NEXT: (type $ref|$[i8]|_=>_none (func (param (ref $[i8]))))
+
+ ;; CHECK: (type $[i8] (array i8))
+ (type $[i8] (array i8))
+
+ ;; CHECK: (type $none_=>_none (func))
+
+ ;; CHECK: (func $0 (type $none_=>_none)
+ ;; CHECK-NEXT: (call $1
+ ;; CHECK-NEXT: (array.new_fixed $[i8])
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $0
+ (call $1
+ (array.new_fixed $[i8])
+ )
+ )
+
+ ;; CHECK: (func $1 (type $ref|$[i8]|_=>_none) (param $2 (ref $[i8]))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (ref.cast struct
+ ;; CHECK-NEXT: (local.get $2)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $1 (param $2 anyref)
+ ;; The param will become non-nullable after we refine. We must refinalize
+ ;; after doing so, so the cast becomes non-nullable as well.
+ (drop
+ (ref.cast null struct
+ (local.get $2)
+ )
+ )
+ )
+) ;; TODO