do lto before dce, since lto opens up dce opportunities

This commit is contained in:
Alon Zakai 2012-12-10 14:51:31 -08:00
Родитель e05a784a78
Коммит 98fda6ea81
1 изменённых файлов: 8 добавлений и 6 удалений

14
emcc
Просмотреть файл

@ -1055,6 +1055,14 @@ try:
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 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 not shared.Building.can_inline(): link_opts.append('-disable-inlining')
link_opts += ['-std-link-opts', '-disable-internalize']
if DEBUG: print >> sys.stderr, 'emcc: LLVM linktime:', link_opts
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), link_opts)
if DEBUG: save_intermediate('linktime', 'bc')
link_opts = []
# At minimum remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
exports = ','.join(map(lambda exp: exp[1:], shared.Settings.EXPORTED_FUNCTIONS))
# internalize carefully, llvm 3.2 will remove even main if not told not to
@ -1062,12 +1070,6 @@ try:
if DEBUG: print >> sys.stderr, 'emcc: LLVM linktime:', link_opts
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), link_opts)
if DEBUG: save_intermediate('dce', 'bc')
if llvm_lto and shared.Building.can_use_unsafe_opts():
if not shared.Building.can_inline(): link_opts.append('-disable-inlining')
link_opts = ['-std-link-opts', '-disable-internalize']
if DEBUG: print >> sys.stderr, 'emcc: LLVM linktime:', link_opts
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), link_opts)
if DEBUG: save_intermediate('linktime', 'bc')
# Prepare .ll for Emscripten
if not LEAVE_INPUTS_RAW: