diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-08-02 14:47:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-02 14:47:05 -0700 |
commit | de15161e110f26212095c5cf4faf2e3668d2531b (patch) | |
tree | 915e18978f4b554d0479b568378a425ec5b042ee /src/passes/OptimizeInstructions.cpp | |
parent | 5a07a930ad51003411b2bc827ea9bf08728ecc5a (diff) | |
parent | 6d686bd1a5b3610ad49fd607ae5e49c70410af51 (diff) | |
download | binaryen-de15161e110f26212095c5cf4faf2e3668d2531b.tar.gz binaryen-de15161e110f26212095c5cf4faf2e3668d2531b.tar.bz2 binaryen-de15161e110f26212095c5cf4faf2e3668d2531b.zip |
Merge pull request #1119 from WebAssembly/fuzz-2
More fun fuzz fixes
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 4fd7cbe8d..f458a58b2 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -228,8 +228,8 @@ Index getMaxBits(Expression* curr, LocalInfoProvider* localInfoProvider) { } } else if (auto* unary = curr->dynCast<Unary>()) { switch (unary->op) { - case ClzInt32: case CtzInt32: case PopcntInt32: return 5; - case ClzInt64: case CtzInt64: case PopcntInt64: return 6; + case ClzInt32: case CtzInt32: case PopcntInt32: return 6; + case ClzInt64: case CtzInt64: case PopcntInt64: return 7; case EqZInt32: case EqZInt64: return 1; case WrapInt64: return std::min(Index(32), getMaxBits(unary->value, localInfoProvider)); default: {} @@ -779,7 +779,7 @@ private: return; } else if (binary->op == ShlInt32) { if (auto* c = binary->right->dynCast<Const>()) { - seek(binary->left, mul * Pow2(c->value.geti32())); + seek(binary->left, mul * Pow2(Bits::getEffectiveShifts(c))); return; } } else if (binary->op == MulInt32) { @@ -836,7 +836,7 @@ private: } } else if (curr->op == ShlInt32) { // shifting a 0 is a 0, unless the shift has side effects - if (left && left->value.geti32() == 0 && !EffectAnalyzer(passOptions, curr->right).hasSideEffects()) { + if (left && Bits::getEffectiveShifts(left) == 0 && !EffectAnalyzer(passOptions, curr->right).hasSideEffects()) { replaceCurrent(left); return; } |