From e47dfd352bcf5ba71d18e402364be3e1c0df939f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 27 Jul 2021 08:21:08 -0700 Subject: [Wasm GC] DeadArgumentElimination: Do not refine return types of tail callees (#4025) If there is a tail call, we can't change the return type of the function, as it must match in the functions doing a tail call of it. --- test/lit/passes/dae-gc.wast | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/lit/passes/dae-gc.wast b/test/lit/passes/dae-gc.wast index f80673cf2..230f757fc 100644 --- a/test/lit/passes/dae-gc.wast +++ b/test/lit/passes/dae-gc.wast @@ -541,4 +541,21 @@ (i32.const 1) ) ) + + ;; This function does a return call of the one after it. The one after it + ;; returns a ref.func of this one. They both begin by returning a funcref; if + ;; we refine the return type of the latter (which ref.func allows us to do) + ;; then the return type would not match, and we would get a validation error. + ;; CHECK: (func $do-return-call (result funcref) + ;; CHECK-NEXT: (return_call $return-ref-func) + ;; CHECK-NEXT: ) + (func $do-return-call (result funcref) + (return_call $return-ref-func) + ) + ;; CHECK: (func $return-ref-func (result funcref) + ;; CHECK-NEXT: (ref.func $do-return-call) + ;; CHECK-NEXT: ) + (func $return-ref-func (result funcref) + (ref.func $do-return-call) + ) ) -- cgit v1.2.3