| ;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. |
| ;; -g --roundtrip are added to show that we properly handle non-nullable locals |
| ;; through the binary format as well (-g is for the function names). |
| ;; RUN: wasm-opt %s -all --ssa --enable-gc-nn-locals -g --roundtrip -S -o - | filecheck %s |
| |
| (module |
| ;; CHECK: (func $nn-locals (type $none_=>_none) |
| ;; CHECK-NEXT: (local $x (ref func)) |
| ;; CHECK-NEXT: (local.set $x |
| ;; CHECK-NEXT: (ref.func $nn-locals) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (local.get $x) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (local.get $x) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $nn-locals |
| ;; A non-nullable local |
| (local $x (ref func)) |
| ;; Set the local, and get it later. The SSA pass will normally handle non- |
| ;; nullability using ref.as_non_null, but with --gc-nn-locals nothing should |
| ;; be done. |
| (local.set $x (ref.func $nn-locals)) |
| (drop (local.get $x)) |
| (drop (local.get $x)) |
| ) |
| ) |