diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-13 15:22:28 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-13 15:22:28 -0700 |
commit | aff455b14835e51d540e878923b83695f8517a88 (patch) | |
tree | 6b622890282c64365b78591ae052bcedce7b4e12 /tools/js-optimizer.js | |
parent | d2317359b2bb02ed4c8f773867c470c5a92a181e (diff) |
avoid creating ~~~ (from ~~ ^ -1) which is confusing for asm given the role of ~~
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r-- | tools/js-optimizer.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index 6987511c..95c4121a 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -562,7 +562,8 @@ function simplifyExpressionsPre(ast) { } else if (type === 'binary' && node[1] === '^') { // LLVM represents bitwise not as xor with -1. Translate it back to an actual bitwise not. if (node[3][0] === 'unary-prefix' && node[3][1] === '-' && node[3][2][0] === 'num' && - node[3][2][1] === 1) { + node[3][2][1] === 1 && + !(node[2][0] == 'unary-prefix' && node[2][1] == '~')) { // avoid creating ~~~ which is confusing for asm given the role of ~~ return ['unary-prefix', '~', node[2]]; } } else if (type === 'binary' && node[1] === '>>' && node[3][0] === 'num' && |