From cde2830e44a3248d0f2d9750f180635c0465a579 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 2 Aug 2021 11:38:50 -0700 Subject: [Wasm GC] Handle unreachability in LocalSubtyping (#4044) --- test/lit/passes/local-subtyping.wast | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'test') diff --git a/test/lit/passes/local-subtyping.wast b/test/lit/passes/local-subtyping.wast index 27f0fe1d0..c24126e1a 100644 --- a/test/lit/passes/local-subtyping.wast +++ b/test/lit/passes/local-subtyping.wast @@ -249,4 +249,39 @@ (local.get $x) ) ) + + ;; CHECK: (func $unreachables (result funcref) + ;; CHECK-NEXT: (local $temp (ref null $none_=>_funcref)) + ;; CHECK-NEXT: (local.set $temp + ;; CHECK-NEXT: (ref.func $unreachables) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block $block (result (ref null $none_=>_funcref)) + ;; CHECK-NEXT: (local.tee $temp + ;; CHECK-NEXT: (ref.func $unreachables) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $temp) + ;; CHECK-NEXT: ) + (func $unreachables (result funcref) + (local $temp funcref) + ;; Set a value that allows us to refine the local's type. + (local.set $temp + (ref.func $unreachables) + ) + (unreachable) + ;; A tee that is not reachable. We must still update its type, and the + ;; parents. + (drop + (block (result funcref) + (local.tee $temp + (ref.func $unreachables) + ) + ) + ) + ;; A get that is not reachable. We must still update its type. + (local.get $temp) + ) ) -- cgit v1.2.3