summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-07-29 12:51:25 -0700
committerGitHub <noreply@github.com>2020-07-29 12:51:25 -0700
commit95a33d7e3233c0f00b0043bb2225d514ae1cd10e (patch)
tree78224aecefe8b8aa18c61966efd64af3f1fba0c3 /src/tools
parent74f0eeff6f9cedf40e32e60595475ec243e8c35e (diff)
downloadbinaryen-95a33d7e3233c0f00b0043bb2225d514ae1cd10e.tar.gz
binaryen-95a33d7e3233c0f00b0043bb2225d514ae1cd10e.tar.bz2
binaryen-95a33d7e3233c0f00b0043bb2225d514ae1cd10e.zip
wasm2js: Remove an incorrect optimization (#3004)
optimizeBoolean does not receive a boolean, it is done when the output flows into a boolean context.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/wasm2js.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/tools/wasm2js.cpp b/src/tools/wasm2js.cpp
index d64f0b0ab..24e4037e7 100644
--- a/src/tools/wasm2js.cpp
+++ b/src/tools/wasm2js.cpp
@@ -254,13 +254,8 @@ static void optimizeJS(Ref ast, Wasm2JSBuilder::Flags flags) {
return false;
};
+ // Optimize given that the expression is flowing into a boolean context
auto optimizeBoolean = [&](Ref node) {
- if (isConstantBinary(node, XOR, 1)) {
- // x ^ 1 => !x
- node[0]->setString(UNARY_PREFIX);
- node[1]->setString(L_NOT);
- node[3]->setNull();
- }
// TODO: in some cases it may be possible to turn
//
// if (x | 0)