From 95a33d7e3233c0f00b0043bb2225d514ae1cd10e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 29 Jul 2020 12:51:25 -0700 Subject: wasm2js: Remove an incorrect optimization (#3004) optimizeBoolean does not receive a boolean, it is done when the output flows into a boolean context. --- src/tools/wasm2js.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') 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) -- cgit v1.2.3