From bcdedab9a97dbea1c2ee151ca1013e3896f16c8a Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 7 Oct 2024 13:43:08 -0700 Subject: Fix a fuzz issue with #6984 (#6988) When I refactored the optimizeDroppedBlock logic in #6982, I didn't move the unreachability check with that code, which was wrong. When that function was called from another place in #6984, the fuzzer found an issue. Diff without whitespace is smaller. This reverts almost all the test updates from #6984 - those changes were on blocks with unreachable children. The change was safe on them, but in general removing a block value in the presence of unreachable code is tricky, so it's best to avoid it. The testcase is a little bizarre, but it's the one the fuzzer found and I can't find a way to generate a better one (other than to reduce it, which I did). --- test/lit/passes/merge-blocks.wast | 9 +++++---- test/lit/passes/monomorphize-drop.wast | 7 ++++++- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'test/lit') diff --git a/test/lit/passes/merge-blocks.wast b/test/lit/passes/merge-blocks.wast index 86181f7a4..6fa1687b8 100644 --- a/test/lit/passes/merge-blocks.wast +++ b/test/lit/passes/merge-blocks.wast @@ -405,11 +405,12 @@ ) ;; CHECK: (func $toplevel (type $4) - ;; CHECK-NEXT: (block $label - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block $label (result i32) + ;; CHECK-NEXT: (br $label + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (br $label) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $toplevel diff --git a/test/lit/passes/monomorphize-drop.wast b/test/lit/passes/monomorphize-drop.wast index 2c6834204..a9f0e1f06 100644 --- a/test/lit/passes/monomorphize-drop.wast +++ b/test/lit/passes/monomorphize-drop.wast @@ -672,7 +672,12 @@ ;; CAREFUL: (func $return-normal_4 (type $1) ;; CAREFUL-NEXT: (drop -;; CAREFUL-NEXT: (call $import) +;; CAREFUL-NEXT: (block +;; CAREFUL-NEXT: (drop +;; CAREFUL-NEXT: (call $import) +;; CAREFUL-NEXT: ) +;; CAREFUL-NEXT: (return) +;; CAREFUL-NEXT: ) ;; CAREFUL-NEXT: ) ;; CAREFUL-NEXT: ) -- cgit v1.2.3