diff options
author | Alon Zakai <azakai@google.com> | 2023-11-01 12:43:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-01 12:43:15 -0700 |
commit | 1890834c69974bc956c26927b1953112e6a81bec (patch) | |
tree | 99951f1b1c39a15bee64be5b30a331bbdd03f06d /test/lit/passes/simplify-locals-gc-nn.wast | |
parent | 5618d2179e44252025831506a7b8b4dba25e7f2f (diff) | |
download | binaryen-1890834c69974bc956c26927b1953112e6a81bec.tar.gz binaryen-1890834c69974bc956c26927b1953112e6a81bec.tar.bz2 binaryen-1890834c69974bc956c26927b1953112e6a81bec.zip |
NonNullable => !Defaultable in SimplifyLocals (#6070)
We handled references but not tuples in one place.
Diffstat (limited to 'test/lit/passes/simplify-locals-gc-nn.wast')
-rw-r--r-- | test/lit/passes/simplify-locals-gc-nn.wast | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/lit/passes/simplify-locals-gc-nn.wast b/test/lit/passes/simplify-locals-gc-nn.wast index 2575ac807..c691ebb3f 100644 --- a/test/lit/passes/simplify-locals-gc-nn.wast +++ b/test/lit/passes/simplify-locals-gc-nn.wast @@ -149,4 +149,28 @@ ) ) ) + + ;; CHECK: (func $if-return-tuple-nn (type $0) + ;; CHECK-NEXT: (local $temp ((ref func) nullref)) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $if-return-tuple-nn + (local $temp ((ref func) (ref null none))) + ;; We should not emit a return value for this if, as the tuple has a non- + ;; nullable element, so it is nondefaultable. + ;; + ;; Instead, we can remove the local.set entirely, as it has no gets. + (if + (i32.const 0) + (local.set $temp + (tuple.make + (ref.func $if-return-tuple-nn) + (ref.null none) + ) + ) + ) + ) ) |