diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2019-06-05 19:34:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-05 19:34:34 -0700 |
commit | 616abe47020c90278eaf8d14ae9815c31d2d14fb (patch) | |
tree | 91ad94c219f2028285605e3285b19d81ad655878 /src | |
parent | 917fabf8fb8c2efbfadc608efa79c0937830ce10 (diff) | |
download | binaryen-616abe47020c90278eaf8d14ae9815c31d2d14fb.tar.gz binaryen-616abe47020c90278eaf8d14ae9815c31d2d14fb.tar.bz2 binaryen-616abe47020c90278eaf8d14ae9815c31d2d14fb.zip |
Use splatted zero vector in makeZero (#2164)
This prevents the optimizer from producing v128.const instructions,
which are not supported by V8 at this time.
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/literal-utils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ir/literal-utils.h b/src/ir/literal-utils.h index 543c34e9f..63a2b3b44 100644 --- a/src/ir/literal-utils.h +++ b/src/ir/literal-utils.h @@ -17,6 +17,7 @@ #ifndef wasm_ir_literal_utils_h #define wasm_ir_literal_utils_h +#include "wasm-builder.h" #include "wasm.h" namespace wasm { @@ -31,6 +32,13 @@ inline Expression* makeFromInt32(int32_t x, Type type, Module& wasm) { } inline Expression* makeZero(Type type, Module& wasm) { + // TODO: Switch to using v128.const once V8 supports it + // (https://bugs.chromium.org/p/v8/issues/detail?id=8460) + if (type == v128) { + Builder builder(wasm); + return builder.makeUnary(SplatVecI32x4, + builder.makeConst(Literal(int32_t(0)))); + } return makeFromInt32(0, type, wasm); } |