|
| 1 | +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. |
| 2 | +;; RUN: wasm-opt %s --inlining --enable-gc-nn-locals -all -S -o - | filecheck %s |
| 3 | + |
| 4 | +(module |
| 5 | + ;; CHECK: (func $caller-nullable |
| 6 | + ;; CHECK-NEXT: (local $0 funcref) |
| 7 | + ;; CHECK-NEXT: (block $__inlined_func$target-nullable |
| 8 | + ;; CHECK-NEXT: (local.set $0 |
| 9 | + ;; CHECK-NEXT: (ref.null func) |
| 10 | + ;; CHECK-NEXT: ) |
| 11 | + ;; CHECK-NEXT: (nop) |
| 12 | + ;; CHECK-NEXT: ) |
| 13 | + ;; CHECK-NEXT: ) |
| 14 | + (func $caller-nullable |
| 15 | + ;; Call a function with a nullable local. After the inlining there will |
| 16 | + ;; be a new local in this function for the use of the inlined code, and also |
| 17 | + ;; we assign the null value to that local in the inlined block (which does |
| 18 | + ;; not matter much here, but in general if we had a loop that the inlined |
| 19 | + ;; block was inside of, that would be important to get the right behavior). |
| 20 | + (call $target-nullable) |
| 21 | + ) |
| 22 | + |
| 23 | + (func $target-nullable |
| 24 | + (local $1 (ref null func)) |
| 25 | + ) |
| 26 | + |
| 27 | + ;; CHECK: (func $caller-non-nullable |
| 28 | + ;; CHECK-NEXT: (local $0 (ref func)) |
| 29 | + ;; CHECK-NEXT: (block $__inlined_func$target-non-nullable |
| 30 | + ;; CHECK-NEXT: (nop) |
| 31 | + ;; CHECK-NEXT: ) |
| 32 | + ;; CHECK-NEXT: ) |
| 33 | + (func $caller-non-nullable |
| 34 | + ;; Call a function with a non-nullable local. After the inlining there will |
| 35 | + ;; be a new local in this function for the use of the inlined code. We do not |
| 36 | + ;; need to zero it out (such locals cannot be used before being set anyhow, so |
| 37 | + ;; no zero is needed; and we cannot set a zero anyhow as none exists for the |
| 38 | + ;; type). |
| 39 | + (call $target-non-nullable) |
| 40 | + ) |
| 41 | + |
| 42 | + (func $target-non-nullable |
| 43 | + (local $1 (ref func)) |
| 44 | + ) |
| 45 | +) |
0 commit comments