From 84af3482c31bb33595cbb72f30070bc27eab721c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 21 Jul 2023 13:12:27 -0700 Subject: SimplifyLocals: Refinalize after removing redundant tees (#5830) --- test/lit/passes/simplify-locals-gc.wast | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/lit/passes') diff --git a/test/lit/passes/simplify-locals-gc.wast b/test/lit/passes/simplify-locals-gc.wast index 365373c83..6b2b10462 100644 --- a/test/lit/passes/simplify-locals-gc.wast +++ b/test/lit/passes/simplify-locals-gc.wast @@ -517,4 +517,28 @@ ) ) ) + + ;; CHECK: (func $redundant-tee-finalize (type $anyref_=>_none) (param $x anyref) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (ref.cast any + ;; CHECK-NEXT: (ref.cast any + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $redundant-tee-finalize (param $x anyref) + ;; The tee in the middle will be removed, as it copies a local to itself. + ;; After doing so, the outer cast should become non-nullable as we + ;; refinalize. + (drop + (ref.cast null any + (local.tee $x + (ref.cast any + (local.get $x) + ) + ) + ) + ) + ) ) -- cgit v1.2.3