diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-02-18 15:47:07 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-02-18 15:47:07 -0800 |
commit | 06b262b3f17f74d476f94ff87af58c70ab070eb1 (patch) | |
tree | c2442e1cf2967d751e2c8b751fda33a0259d5472 | |
parent | 3e3dc0bbd3029200a6d4fa3866444be54ec27616 (diff) |
run closure in -O3, it makes sense there with the other unsafe optimizations
-rwxr-xr-x | emcc | 21 | ||||
-rwxr-xr-x | tests/runner.py | 4 | ||||
-rw-r--r-- | tools/shared.py | 1 |
3 files changed, 18 insertions, 8 deletions
@@ -159,10 +159,17 @@ Options that are modified or new in %s include: -O2 As -O1, plus the relooper (loop recreation), plus LLVM -O2 optimizations -O3 As -O2, plus dangerous optimizations that may - break the generated code! This is not - recommended at all, see the wiki for more - details (you can try -O2 and then add - dangerous optimizations one by one). + break the generated code! This turns on + + INLINING_LIMIT = 0 + DOUBLE_MODE = 0 + PRECISE_I64_MATH = 0 + and the closure compiler + + This is not recommended at all. A better idea + is to try each of these separately on top of + -O2 to see what works. See the wiki for more + information. -s OPTION=VALUE JavaScript code generation option passed into the emscripten compiler. For the @@ -206,12 +213,13 @@ Options that are modified or new in %s include: (see --llvm-opts), setting this to 1 has no effect. - --closure <on> 0: No closure compiler (default) + --closure <on> 0: No closure compiler (default in -O2 and below) 1: Run closure compiler. This greatly reduces code size and may in some cases increase runtime speed (although the opposite can also occur). Note that it takes time to run, and - may require some changes to the code. + may require some changes to the code. This + is run by default in -O3. --js-transform <cmd> <cmd> will be called on the generated code before it is optimized. This lets you modify @@ -756,6 +764,7 @@ try: if llvm_opts is None: llvm_opts = LLVM_OPT_LEVEL[opt_level] if llvm_lto is None: llvm_lto = llvm_opts > 0 if opt_level <= 0: keep_debug = True # always keep debug in -O0 + if closure is None and opt_level == 3: closure = True if DEBUG: start_time = time.time() # done after parsing arguments, which might affect debug state diff --git a/tests/runner.py b/tests/runner.py index 259d8188..abd925bf 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -8292,14 +8292,14 @@ Options that are modified or new in %s include: (['-o', 'something.js', '-O2'], 2, None, 0, 1), (['-o', 'something.js', '-O2', '--closure', '0'], 2, None, 0, 0), (['-o', 'something.js', '-O2', '-g'], 2, None, 0, 0), - (['-o', 'something.js', '-O3'], 3, None, 0, 1), + (['-o', 'something.js', '-O3'], 3, None, 1, 1), (['-o', 'something.js', '-O3', '--closure', '0'], 3, None, 0, 0), # and, test compiling to bitcode first (['-o', 'something.bc'], 0, [], 0, 0), (['-o', 'something.bc'], 0, ['-O0'], 0, 0), (['-o', 'something.bc'], 1, ['-O1'], 0, 0), (['-o', 'something.bc'], 2, ['-O2'], 0, 0), - (['-o', 'something.bc'], 3, ['-O3'], 0, 0), + (['-o', 'something.bc'], 3, ['-O3'], 1, 0), (['-O1', '-o', 'something.bc'], 0, [], 0, 0), # -Ox is ignored and warned about ]: print params, opt_level, bc_params, closure, has_malloc diff --git a/tools/shared.py b/tools/shared.py index 401a580b..0282fbb1 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -566,6 +566,7 @@ class Settings: if opt_level >= 2: Settings.RELOOP = 1 if opt_level >= 3: + # Aside from these, -O3 also runs closure compiler Settings.INLINING_LIMIT = 0 Settings.DOUBLE_MODE = 0 Settings.PRECISE_I64_MATH = 0 |