diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-11-07 10:20:42 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-07 10:20:42 -0800 |
commit | 89d393ed02f6b15a3a8dc60b489f969184070625 (patch) | |
tree | 01b3e429c5afb8794c972c27276385345f53e8b8 /test/unit.asm.js | |
parent | 033b5e161e677173bda01aad9e6850545b93c97e (diff) | |
parent | 4a3892d31288bded757e3805cb53d4e20ccc6be0 (diff) | |
download | binaryen-89d393ed02f6b15a3a8dc60b489f969184070625.tar.gz binaryen-89d393ed02f6b15a3a8dc60b489f969184070625.tar.bz2 binaryen-89d393ed02f6b15a3a8dc60b489f969184070625.zip |
Merge pull request #827 from WebAssembly/relooper
Reloop if-loops with label targets
Diffstat (limited to 'test/unit.asm.js')
-rw-r--r-- | test/unit.asm.js | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/test/unit.asm.js b/test/unit.asm.js index cfe99e0f3..0c1ad9fa8 100644 --- a/test/unit.asm.js +++ b/test/unit.asm.js @@ -542,6 +542,37 @@ function asm(global, env, buffer) { } } + function relooperJumpThreading_irreducible(x) { + x = x | 0; + var label = 0; + if ((x|0) == 100) { + label = 1; + } else { + label = 10; + } + if ((label|0) == 1) { + while (1) { + relooperJumpThreading_irreducible(1337); + label = 1; // this is ok - the if means the body of the if begins with the block for 1. so a setting inside the body of the if must return to the top of the if + } + } + // too many settings, we just look one back, so this one will not be optimized + if ((x|0) == 200) { + label = 2; + } else { + label = 10; + } + if ((x|0) == 300) { + label = 2; + } + if ((label|0) == 2) { + relooperJumpThreading_irreducible(1448); + } + if ((label|0) == 10) { + relooperJumpThreading_irreducible(2000); + } + } + function __Z12multi_varargiz($0) { $0 = $0|0; var $2 = 0, $$06$i4 = 0, $exitcond$i6 = 0, $12 = 0, $20 = 0; @@ -627,6 +658,6 @@ function asm(global, env, buffer) { var FUNCTION_TABLE_c = [ z, cneg, z, z, z, z, z, z ]; var FUNCTION_TABLE_vi = [ vi, vi, vi, vi, vi, vi, vi, vi ]; - return { big_negative: big_negative, pick: forgetMe, pick: exportMe, doubleCompares: doubleCompares, intOps: intOps, conversions: conversions, switcher: switcher, frem: frem, big_uint_div_u: big_uint_div_u, fr: fr, negZero: negZero, neg: neg, smallCompare: smallCompare, cneg_nosemicolon: cneg_nosemicolon, forLoop: forLoop, ceiling_32_64: ceiling_32_64, aborts: aborts, continues: continues, bitcasts: bitcasts, recursiveBlockMerging: recursiveBlockMerging, lb: lb, zeroInit: zeroInit, phi: phi, smallIf: smallIf, dropCall: dropCall, useSetGlobal: useSetGlobal, usesSetGlobal2: usesSetGlobal2, breakThroughMany: breakThroughMany, ifChainEmpty: ifChainEmpty, heap8NoShift: heap8NoShift, conditionalTypeFun: conditionalTypeFun, loadSigned: loadSigned, globalOpts: globalOpts, dropCallImport: dropCallImport, loophi: loophi, loophi2: loophi2, relooperJumpThreading: relooperJumpThreading, relooperJumpThreading__ZN4game14preloadweaponsEv: relooperJumpThreading__ZN4game14preloadweaponsEv, __Z12multi_varargiz: __Z12multi_varargiz, jumpThreadDrop: jumpThreadDrop, dropIgnoredImportInIf: dropIgnoredImportInIf, dropIgnoredImportsInIf: dropIgnoredImportsInIf }; + return { big_negative: big_negative, pick: forgetMe, pick: exportMe, doubleCompares: doubleCompares, intOps: intOps, conversions: conversions, switcher: switcher, frem: frem, big_uint_div_u: big_uint_div_u, fr: fr, negZero: negZero, neg: neg, smallCompare: smallCompare, cneg_nosemicolon: cneg_nosemicolon, forLoop: forLoop, ceiling_32_64: ceiling_32_64, aborts: aborts, continues: continues, bitcasts: bitcasts, recursiveBlockMerging: recursiveBlockMerging, lb: lb, zeroInit: zeroInit, phi: phi, smallIf: smallIf, dropCall: dropCall, useSetGlobal: useSetGlobal, usesSetGlobal2: usesSetGlobal2, breakThroughMany: breakThroughMany, ifChainEmpty: ifChainEmpty, heap8NoShift: heap8NoShift, conditionalTypeFun: conditionalTypeFun, loadSigned: loadSigned, globalOpts: globalOpts, dropCallImport: dropCallImport, loophi: loophi, loophi2: loophi2, relooperJumpThreading: relooperJumpThreading, relooperJumpThreading__ZN4game14preloadweaponsEv: relooperJumpThreading__ZN4game14preloadweaponsEv, __Z12multi_varargiz: __Z12multi_varargiz, jumpThreadDrop: jumpThreadDrop, dropIgnoredImportInIf: dropIgnoredImportInIf, dropIgnoredImportsInIf: dropIgnoredImportsInIf, relooperJumpThreading_irreducible: relooperJumpThreading_irreducible }; } |