diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2019-04-17 20:08:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-17 20:08:43 -0700 |
commit | 2d6e3e108d0f4a484a7dde47c98081537754350e (patch) | |
tree | 3cf04819ee663c7ab1f26442c62dd49f77992dd2 | |
parent | f20f8c39adccc8593c0eea3b98378ca9549f9c26 (diff) | |
download | binaryen-2d6e3e108d0f4a484a7dde47c98081537754350e.tar.gz binaryen-2d6e3e108d0f4a484a7dde47c98081537754350e.tar.bz2 binaryen-2d6e3e108d0f4a484a7dde47c98081537754350e.zip |
Do not precompute bulk memory operations (#2023)
Fixes #1984
-rw-r--r-- | src/passes/Precompute.cpp | 12 | ||||
-rw-r--r-- | test/passes/precompute_all-features.txt (renamed from test/passes/precompute_enable-simd.txt) | 27 | ||||
-rw-r--r-- | test/passes/precompute_all-features.wast (renamed from test/passes/precompute_enable-simd.wast) | 28 |
3 files changed, 65 insertions, 2 deletions
diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index 50c17510f..565809ddb 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -122,6 +122,18 @@ public: Flow visitAtomicNotify(AtomicNotify *curr) { return Flow(NOTPRECOMPUTABLE_FLOW); } + Flow visitMemoryInit(MemoryInit *curr) { + return Flow(NOTPRECOMPUTABLE_FLOW); + } + Flow visitDataDrop(DataDrop *curr) { + return Flow(NOTPRECOMPUTABLE_FLOW); + } + Flow visitMemoryCopy(MemoryCopy *curr) { + return Flow(NOTPRECOMPUTABLE_FLOW); + } + Flow visitMemoryFill(MemoryFill *curr) { + return Flow(NOTPRECOMPUTABLE_FLOW); + } Flow visitHost(Host *curr) { return Flow(NOTPRECOMPUTABLE_FLOW); } diff --git a/test/passes/precompute_enable-simd.txt b/test/passes/precompute_all-features.txt index f7f58f58f..a6eae53d3 100644 --- a/test/passes/precompute_enable-simd.txt +++ b/test/passes/precompute_all-features.txt @@ -4,7 +4,8 @@ (type $2 (func)) (type $3 (func (result f64))) (type $4 (func (result v128))) - (memory $0 0) + (memory $0 512 512) + (data (i32.const 0) "passive") (global $global i32 (i32.const 1)) (global $global-mut (mut i32) (i32.const 2)) (func $x (; 0 ;) (type $0) (param $x i32) @@ -224,4 +225,28 @@ ) ) ) + (func $no-memory-init-precompute (; 13 ;) (type $2) + (memory.init 0 + (i32.const 512) + (i32.const 0) + (i32.const 12) + ) + ) + (func $no-data-drop-precompute (; 14 ;) (type $2) + (data.drop 0) + ) + (func $no-memory-copy-precompute (; 15 ;) (type $2) + (memory.copy + (i32.const 512) + (i32.const 0) + (i32.const 12) + ) + ) + (func $no-memory-fill-precompute (; 16 ;) (type $2) + (memory.fill + (i32.const 512) + (i32.const 0) + (i32.const 12) + ) + ) ) diff --git a/test/passes/precompute_enable-simd.wast b/test/passes/precompute_all-features.wast index d6b1cc1b7..28c570b7a 100644 --- a/test/passes/precompute_enable-simd.wast +++ b/test/passes/precompute_all-features.wast @@ -1,5 +1,7 @@ (module - (memory 0) + (memory 512 512 + (data passive "hello!") + ) (type $0 (func (param i32))) (global $global i32 (i32.const 1)) (global $global-mut (mut i32) (i32.const 2)) @@ -318,4 +320,28 @@ ) ) ) + (func $no-memory-init-precompute + (memory.init 0 + (i32.const 512) + (i32.const 0) + (i32.const 12) + ) + ) + (func $no-data-drop-precompute + (data.drop 0) + ) + (func $no-memory-copy-precompute + (memory.copy + (i32.const 512) + (i32.const 0) + (i32.const 12) + ) + ) + (func $no-memory-fill-precompute + (memory.fill + (i32.const 512) + (i32.const 0) + (i32.const 12) + ) + ) ) |