aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-27 12:04:36 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-06-27 12:05:53 -0700
commit0432f1c7910cf12b51ea84a0a4cacb3465f40c63 (patch)
treebae9316b19e3c4ae12b197f75d8e554fea6c2894
parent681ab3e9157f15c8276695413648b2ba9775894b (diff)
add option for -O3 style LTO without normal LLVM LTO, because java-nbody hits an LTO bug but benefits from -O3 on all the code
-rwxr-xr-xemcc16
-rwxr-xr-xtests/runner.py4
2 files changed, 11 insertions, 9 deletions
diff --git a/emcc b/emcc
index 2e49a879..705538fc 100755
--- a/emcc
+++ b/emcc
@@ -139,7 +139,7 @@ Options that are modified or new in %s include:
-s DOUBLE_MODE=0
-s PRECISE_I64_MATH=0
--closure 1
- --llvm-lto 2
+ --llvm-lto 3
This is not recommended at all. A better idea
is to try each of these separately on top of
@@ -217,12 +217,14 @@ Options that are modified or new in %s include:
--llvm-lto <level> 0: No LLVM LTO (default)
1: LLVM LTO is performed
+ 2: We combine all the bitcode and run LLVM opt -O3
+ on that (which optimizes across modules, but is
+ not the same as normal LTO), but do not do normal
+ LTO
+ 3: We do both 2 and then 1
Note: If LLVM optimizations are not run
- (see --llvm-opts), setting this to 1 has no
+ (see --llvm-opts), setting this has no
effect.
- 2: LLVM LTO is performed, and we supplement it
- with pre-running LLVM opt -O3 on the full
- combined bitcode
--closure <on> 0: No closure compiler (default in -O2 and below)
1: Run closure compiler. This greatly reduces
@@ -882,7 +884,7 @@ try:
newargs = newargs + [default_cxx_std]
if llvm_opts is None: llvm_opts = LLVM_OPT_LEVEL[opt_level]
- if llvm_lto is None and opt_level >= 3: llvm_lto = 2
+ if llvm_lto is None and opt_level >= 3: llvm_lto = 3
if opt_level == 0: debug_level = 4
if closure is None and opt_level == 3: closure = True
@@ -1433,7 +1435,7 @@ try:
if shared.Building.can_build_standalone():
# If we can LTO, do it before dce, since it opens up dce opportunities
- if llvm_lto and shared.Building.can_use_unsafe_opts():
+ if llvm_lto and llvm_lto != 2 and shared.Building.can_use_unsafe_opts():
if not shared.Building.can_inline(): link_opts.append('-disable-inlining')
# do not internalize in std-link-opts - it ignores internalize-public-api-list - and add a manual internalize
link_opts += ['-disable-internalize'] + shared.Building.get_safe_internalize() + ['-std-link-opts']
diff --git a/tests/runner.py b/tests/runner.py
index 8fd14609..d20d7c2f 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -13419,7 +13419,7 @@ process(sys.argv[1])
try_delete(final_filename)
output = Popen([PYTHON, EMCC, filename, #'-O3',
'-O2', '-s', 'DOUBLE_MODE=0', '-s', 'PRECISE_I64_MATH=0',
- '--llvm-lto', '2', '--memory-init-file', '0', '--js-transform', 'python hardcode.py',
+ '--llvm-lto', '3', '--memory-init-file', '0', '--js-transform', 'python hardcode.py',
'-s', 'TOTAL_MEMORY=128*1024*1024',
'--closure', '1',
#'-g',
@@ -13737,7 +13737,7 @@ process(sys.argv[1])
args = [path_from_root('tests', 'nbody-java', x) for x in os.listdir(path_from_root('tests', 'nbody-java')) if x.endswith('.c')] + \
['-I' + path_from_root('tests', 'nbody-java')]
self.do_benchmark('nbody_java', '', '''Time(s)''',
- force_c=True, emcc_args=args + ['-s', 'PRECISE_I64_MATH=1', '--llvm-lto', '0'], native_args=args + ['-lgc', '-std=c99', '-target', 'x86_64-pc-linux-gnu', '-lm'])
+ force_c=True, emcc_args=args + ['-s', 'PRECISE_I64_MATH=1', '--llvm-lto', '2'], native_args=args + ['-lgc', '-std=c99', '-target', 'x86_64-pc-linux-gnu', '-lm'])
def lua(self, benchmark, expected, output_parser=None, args_processor=None):
shutil.copyfile(path_from_root('tests', 'lua', benchmark + '.lua'), benchmark + '.lua')