diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-04-10 19:39:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-10 19:39:12 -0700 |
commit | 6b517f6f70d5af72ed5d217a307a0b9b9284be24 (patch) | |
tree | b946205a2c229abff129b67b5f89a33f44a7469f | |
parent | 7be5d23122aba2791fb6ff382bcaa19388a72932 (diff) | |
download | binaryen-6b517f6f70d5af72ed5d217a307a0b9b9284be24.tar.gz binaryen-6b517f6f70d5af72ed5d217a307a0b9b9284be24.tar.bz2 binaryen-6b517f6f70d5af72ed5d217a307a0b9b9284be24.zip |
don't precompute anything to a vector for now (#1999)
We handled this for the normal case, but the optimizer can also precompute a return into a value, so check the output of the precomputation as well.
-rw-r--r-- | src/passes/Precompute.cpp | 3 | ||||
-rw-r--r-- | test/passes/precompute.txt | 7 | ||||
-rw-r--r-- | test/passes/precompute.wast | 7 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index 6f59fceb7..50c17510f 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -168,9 +168,10 @@ struct Precompute : public WalkerPass<PostWalker<Precompute, UnifiedExpressionVi // Until engines implement v128.const and we have SIMD-aware optimizations // that can break large v128.const instructions into smaller consts and // splats, do not try to precompute v128 expressions. - if (curr->type == v128) return; + if (isVectorType(curr->type)) return; // try to evaluate this into a const Flow flow = precomputeExpression(curr); + if (isVectorType(flow.value.type)) return; if (flow.breaking()) { if (flow.breakTo == NOTPRECOMPUTABLE_FLOW) return; if (flow.breakTo == RETURN_FLOW) { diff --git a/test/passes/precompute.txt b/test/passes/precompute.txt index 8b2d82f64..f7f58f58f 100644 --- a/test/passes/precompute.txt +++ b/test/passes/precompute.txt @@ -217,4 +217,11 @@ (i32.const 0) ) ) + (func $no-simd-precompute-if (; 12 ;) (type $4) (result v128) + (return + (i32x4.splat + (i32.const 0) + ) + ) + ) ) diff --git a/test/passes/precompute.wast b/test/passes/precompute.wast index 000835f4a..d6b1cc1b7 100644 --- a/test/passes/precompute.wast +++ b/test/passes/precompute.wast @@ -311,4 +311,11 @@ (i32.const 0) ) ) + (func $no-simd-precompute-if (result v128) + (return + (i32x4.splat + (i32.const 0) + ) + ) + ) ) |