From ec6ef26ec4f4fdfc974e7087896ac004ac7c130a Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 19 Jul 2021 09:07:50 -0700 Subject: Revert "Partially fix Precompute on SIMD (#3983)" (#4002) This reverts commit b68691e826a46d1b03b27c552b1f5b7f51f92665. Instead of applying the workaround to avoid precomputing SIMD in more places, which prevents things we could optimize before, we should probably focus on making the workaround not needed - that is, implement full SIMD support in the intepreter (the reason for that PR), and the other TODO in the comment here, // 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. --- src/passes/Precompute.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index fa6e8e9ed..a832c9e85 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -172,8 +172,17 @@ struct Precompute if (Properties::isConstantExpression(curr) || curr->is()) { return; } + // 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.isVector()) { + return; + } // try to evaluate this into a const Flow flow = precomputeExpression(curr); + if (flow.getType().hasVector()) { + return; + } if (!canEmitConstantFor(flow.values)) { return; } @@ -227,12 +236,6 @@ private: // Precompute an expression, returning a flow, which may be a constant // (that we can replace the expression with if replaceExpression is set). Flow precomputeExpression(Expression* curr, bool replaceExpression = true) { - // 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.isVector()) { - return Flow(NONCONSTANT_FLOW); - } Flow flow; try { flow = @@ -247,9 +250,6 @@ private: !canEmitConstantFor(flow.values)) { return Flow(NONCONSTANT_FLOW); } - if (flow.getType().hasVector()) { - return Flow(NONCONSTANT_FLOW); - } return flow; } -- cgit v1.2.3