diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index 274689c0167..f8d9164747f 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -215,6 +215,7 @@ class PrecomputingExpressionRunner } // ArrayLen is not disallowed here as it is an immutable property. Flow visitArrayCopy(ArrayCopy* curr) { return Flow(NONCONSTANT_FLOW); } + Flow visitArrayStore(ArrayStore* curr) { return Flow(NONCONSTANT_FLOW); } // Generates heap info for a heap-allocating expression. Flow getGCAllocation(Expression* curr, std::function visitFunc) { diff --git a/test/lit/passes/precompute-gc-multibyte.wast b/test/lit/passes/precompute-gc-multibyte.wast new file mode 100644 index 00000000000..d45a284da59 --- /dev/null +++ b/test/lit/passes/precompute-gc-multibyte.wast @@ -0,0 +1,24 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. + +;; RUN: foreach %s %t wasm-opt --precompute-propagate -all -S -o - | filecheck %s + +(module + ;; CHECK: (type $array (array (mut i8))) + (type $array (array (mut i8))) + + ;; CHECK: (func $array.store (type $1) (param $x (ref $array)) + ;; CHECK-NEXT: (i64.store32 (type $array) + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i64.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $array.store (param $x (ref $array)) + ;; ArrayStore operations cannot be removed. + (i64.store32 (type $array) + (local.get $x) + (i32.const 0) + (i64.const 1) + ) + ) +)