summaryrefslogtreecommitdiff
path: root/test/lit/passes/optimize-instructions-gc-heap.wast
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-10-21 12:15:46 -0700
committerGitHub <noreply@github.com>2022-10-21 12:15:46 -0700
commitc25f32dec81d9401efb64cf134aa87991ef21e9d (patch)
treecc8b2f5d244561663b4f908cad9eb3c5ae281202 /test/lit/passes/optimize-instructions-gc-heap.wast
parent884fe9bcee0a7aa10a427d76bd317bb136258dc6 (diff)
downloadbinaryen-c25f32dec81d9401efb64cf134aa87991ef21e9d.tar.gz
binaryen-c25f32dec81d9401efb64cf134aa87991ef21e9d.tar.bz2
binaryen-c25f32dec81d9401efb64cf134aa87991ef21e9d.zip
[Wasm GC] Externalize/Internalize allow nulls (#5175)
These are encoded as RefAs operations, and we have optimizations that assume those trap on null, but Externalize/Internalize do not. Skip them there to avoid an error on the type being incorrect later.
Diffstat (limited to 'test/lit/passes/optimize-instructions-gc-heap.wast')
-rw-r--r--test/lit/passes/optimize-instructions-gc-heap.wast54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/lit/passes/optimize-instructions-gc-heap.wast b/test/lit/passes/optimize-instructions-gc-heap.wast
index e448e57fd..b77678760 100644
--- a/test/lit/passes/optimize-instructions-gc-heap.wast
+++ b/test/lit/passes/optimize-instructions-gc-heap.wast
@@ -766,4 +766,58 @@
(func $helper-i32 (param $x i32) (result i32)
(i32.const 42)
)
+
+ ;; CHECK: (func $extern.externalize (param $x anyref) (param $y externref)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (extern.externalize
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (extern.externalize
+ ;; CHECK-NEXT: (ref.as_non_null
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (extern.internalize
+ ;; CHECK-NEXT: (local.get $y)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (extern.internalize
+ ;; CHECK-NEXT: (ref.as_non_null
+ ;; CHECK-NEXT: (local.get $y)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $extern.externalize (export "ext") (param $x (ref null any)) (param $y (ref null extern))
+ ;; We should not change anything here, and also not hit an internal error.
+ (drop
+ (extern.externalize
+ (local.get $x)
+ )
+ )
+ (drop
+ (extern.externalize
+ (ref.as_non_null
+ (local.get $x)
+ )
+ )
+ )
+ (drop
+ (extern.internalize
+ (local.get $y)
+ )
+ )
+ (drop
+ (extern.internalize
+ (ref.as_non_null
+ (local.get $y)
+ )
+ )
+ )
+ )
)