summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2019-10-30 15:55:01 -0700
committerGitHub <noreply@github.com>2019-10-30 15:55:01 -0700
commit2a787cdbe4cfb84801d4f885b155555c864ac006 (patch)
tree67479f485624189c4d2f010074661ccdf66927b7
parent74d438ec0e3c51d757e8a0fa0e461824b9e1d161 (diff)
downloadbinaryen-2a787cdbe4cfb84801d4f885b155555c864ac006.tar.gz
binaryen-2a787cdbe4cfb84801d4f885b155555c864ac006.tar.bz2
binaryen-2a787cdbe4cfb84801d4f885b155555c864ac006.zip
Do not precompute SIMDLoad (#2409)
This fixes a crash when programs containing load_splats are optimized.
-rw-r--r--Contributing.md1
-rw-r--r--src/passes/Precompute.cpp1
-rw-r--r--test/passes/precompute-propagate_all-features.txt (renamed from test/passes/precompute-propagate.txt)10
-rw-r--r--test/passes/precompute-propagate_all-features.wast (renamed from test/passes/precompute-propagate.wast)6
4 files changed, 17 insertions, 1 deletions
diff --git a/Contributing.md b/Contributing.md
index 3e836eb15..e76ccda85 100644
--- a/Contributing.md
+++ b/Contributing.md
@@ -17,6 +17,7 @@ Use this handy checklist to make sure your new instructions are fully supported:
- [ ] Validation added to src/wasm/wasm-validator.cpp
- [ ] Interpretation added to src/wasm-interpreter.h
- [ ] Effects handled in src/ir/effects.h
+ - [ ] Precomputing handled in src/passes/Precompute.cpp
- [ ] Hashing and comparing in src/ir/ExpressionAnalyzer.cpp
- [ ] Parsing added in scripts/gen-s-parser.py and src/wasm/wasm-s-parser.cpp
- [ ] Printing added in src/passes/Print.cpp
diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp
index c4d90de04..43ecadf7f 100644
--- a/src/passes/Precompute.cpp
+++ b/src/passes/Precompute.cpp
@@ -125,6 +125,7 @@ public:
Flow visitAtomicNotify(AtomicNotify* curr) {
return Flow(NOTPRECOMPUTABLE_FLOW);
}
+ Flow visitSIMDLoad(SIMDLoad* 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); }
diff --git a/test/passes/precompute-propagate.txt b/test/passes/precompute-propagate_all-features.txt
index a544c30ba..93ec352ee 100644
--- a/test/passes/precompute-propagate.txt
+++ b/test/passes/precompute-propagate_all-features.txt
@@ -3,6 +3,7 @@
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
+ (type $FUNCSIG$V (func (result v128)))
(memory $0 10 10)
(func $basic (; 0 ;) (type $FUNCSIG$vi) (param $p i32)
(local $x i32)
@@ -254,4 +255,13 @@
(i32.const 14)
)
)
+ (func $simd-load (; 17 ;) (type $FUNCSIG$V) (result v128)
+ (local $x v128)
+ (local.set $x
+ (v8x16.load_splat
+ (i32.const 0)
+ )
+ )
+ (local.get $x)
+ )
)
diff --git a/test/passes/precompute-propagate.wast b/test/passes/precompute-propagate_all-features.wast
index 17da74085..169337fc3 100644
--- a/test/passes/precompute-propagate.wast
+++ b/test/passes/precompute-propagate_all-features.wast
@@ -170,5 +170,9 @@
)
)
)
+ (func $simd-load (result v128)
+ (local $x v128)
+ (local.set $x (v8x16.load_splat (i32.const 0)))
+ (local.get $x)
+ )
)
-