aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-29 21:05:12 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-29 21:05:12 -0800
commit7caf985807c372e609425d45f7630ea0407c9abb (patch)
treeeedf1d460b2906a62ba7c94cbf92d997389726d5
parent3ebc504f277b288b36582f4c44c657ace7d20854 (diff)
split LLVM LTO into separate pass
-rwxr-xr-xemcc10
-rw-r--r--tools/shared.py1
2 files changed, 7 insertions, 4 deletions
diff --git a/emcc b/emcc
index 11c6b6b9..ae08c516 100755
--- a/emcc
+++ b/emcc
@@ -561,15 +561,19 @@ try:
# Optimize, if asked to
if llvm_opts > 0 and opt_level > 0 and not LEAVE_INPUTS_RAW:
- if DEBUG: print >> sys.stderr, 'emcc: LLVM opts'
+ if DEBUG: print >> sys.stderr, 'emcc: LLVM -O%d' % LLVM_OPT_LEVEL[opt_level]
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), LLVM_OPT_LEVEL[opt_level])
+ if DEBUG: save_intermediate('opt', 'bc')
+ # Do LTO in a separate pass to work around LLVM bug XXX (see failure e.g. in cubescript)
+ if DEBUG: print >> sys.stderr, 'emcc: LLVM LTO'
+ shared.Building.llvm_opt(in_temp(target_basename + '.bc'), ['-disable-inlining', '-std-link-opts'])
+ if DEBUG: save_intermediate('lto', 'bc')
else:
# If possible, remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
if not LEAVE_INPUTS_RAW and not shared.Settings.BUILD_AS_SHARED_LIB and not shared.Settings.LINKABLE:
if DEBUG: print >> sys.stderr, 'emcc: LLVM dead globals elimination'
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), ['-internalize', '-globaldce'])
-
- if DEBUG and not LEAVE_INPUTS_RAW: save_intermediate('optbc', 'bc')
+ if DEBUG: save_intermediate('dce', 'bc')
# Prepare .ll for Emscripten
try:
diff --git a/tools/shared.py b/tools/shared.py
index 8c0f75cb..e43ac8ab 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -547,7 +547,6 @@ class Building:
opts.append('-disable-inlining') # we prefer to let closure compiler do our inlining, to avoid overly aggressive inlining
opts.append('-O%d' % optimization_level)
#opts.append('-std-compile-opts')
- opts.append('-std-link-opts')
else:
allow_nonportable = not safe
optimize_size = True