diff --git a/scripts/test/fuzzing.py b/scripts/test/fuzzing.py index 7f951ce94cc..33bfacfe1f5 100644 --- a/scripts/test/fuzzing.py +++ b/scripts/test/fuzzing.py @@ -109,6 +109,7 @@ 'O3_stack-switching.wast', 'coalesce-locals-stack-switching.wast', 'dce-stack-switching.wast', + 'local-cse-cont.wast', 'precompute-stack-switching.wast', 'unsubtyping-stack-switching.wast', 'vacuum-stack-switching.wast', diff --git a/src/ir/properties.cpp b/src/ir/properties.cpp index d047718850c..8bc8c1d8f6f 100644 --- a/src/ir/properties.cpp +++ b/src/ir/properties.cpp @@ -38,6 +38,7 @@ struct GenerativityScanner : public PostWalker { void visitArrayNewData(ArrayNewData* curr) { generative = true; } void visitArrayNewElem(ArrayNewElem* curr) { generative = true; } void visitArrayNewFixed(ArrayNewFixed* curr) { generative = true; } + void visitContNew(ContNew* curr) { generative = true; } }; } // anonymous namespace diff --git a/test/lit/passes/local-cse-cont.wast b/test/lit/passes/local-cse-cont.wast new file mode 100644 index 00000000000..77dea17f85b --- /dev/null +++ b/test/lit/passes/local-cse-cont.wast @@ -0,0 +1,40 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt --local-cse -all -S -o - | filecheck %s + +(module + ;; CHECK: (type $func (func)) + (type $func (func)) + ;; CHECK: (type $cont (cont $func)) + (type $cont (cont $func)) + + ;; CHECK: (elem declare func $cont.new) + + ;; CHECK: (func $cont.new (type $func) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (cont.new $cont + ;; CHECK-NEXT: (ref.func $cont.new) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (cont.new $cont + ;; CHECK-NEXT: (ref.func $cont.new) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $cont.new (type $func) + ;; We cannot CSE here, as each of these emits a unique continuation. + (drop + (cont.new $cont + (ref.func $cont.new) + ) + ) + (drop + (cont.new $cont + (ref.func $cont.new) + ) + ) + ) +) +