diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/wasm-reduce.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index 6b4483dd2..82594cd25 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -1039,7 +1039,12 @@ struct Reducer builder->makeConstantExpression(Literal::makeZeros(curr->type)); return tryToReplaceCurrent(n); } - Const* c = builder->makeConst(int32_t(0)); + if (!curr->type.isNumber()) { + return false; + } + // It's a number: try to replace it with a 0 or a 1 (trying more values + // could make sense too, but these handle most cases). + auto* c = builder->makeConst(Literal::makeZero(curr->type)); if (tryToReplaceCurrent(c)) { return true; } |