diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-04-22 09:37:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-22 09:37:15 -0700 |
commit | b8d93ea629f59f534093d20f37cb8baf9809062e (patch) | |
tree | 6d6039072cf6ca424daf92bdae692fc472797ab0 | |
parent | b99d668ead5c6a6a4891ec58b5a53e80ea9f5705 (diff) | |
download | binaryen-b8d93ea629f59f534093d20f37cb8baf9809062e.tar.gz binaryen-b8d93ea629f59f534093d20f37cb8baf9809062e.tar.bz2 binaryen-b8d93ea629f59f534093d20f37cb8baf9809062e.zip |
wasm2js: remove some unneeded code, which also has some risks of incorrectness (#2032)
The risk is that the children's type may be unreachable, in which case we may have forgotten the signing, and could get incorrect results.
-rw-r--r-- | src/wasm2js.h | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h index 311f8be10..47d75e2c2 100644 --- a/src/wasm2js.h +++ b/src/wasm2js.h @@ -1648,21 +1648,12 @@ Ref Wasm2JSBuilder::processFunctionBody(Module* m, Function* func, IString resul ret = ValueBuilder::makeBinary(left, RSHIFT, right); break; case EqInt32: { - // TODO: check if this condition is still valid/necessary - if (curr->left->type == i32) { - return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), EQ, - makeSigning(right, ASM_SIGNED)); - } else { - return ValueBuilder::makeBinary(left, EQ, right); - } + return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), EQ, + makeSigning(right, ASM_SIGNED)); } case NeInt32: { - if (curr->left->type == i32) { - return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), NE, - makeSigning(right, ASM_SIGNED)); - } else { - return ValueBuilder::makeBinary(left, NE, right); - } + return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), NE, + makeSigning(right, ASM_SIGNED)); } case LtSInt32: return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), LT, |