aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc6
1 files changed, 6 insertions, 0 deletions
diff --git a/emcc b/emcc
index d2b5004c..6461dbb7 100755
--- a/emcc
+++ b/emcc
@@ -512,6 +512,11 @@ try:
if llvm_opt_level > 0 and not LEAVE_INPUTS_RAW:
if DEBUG: print >> sys.stderr, 'emcc: LLVM opts'
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), LLVM_INTERNAL_OPT_LEVEL, safe=llvm_opt_level < 2)
+ 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 shared.Settings.BUILD_AS_SHARED_LIB:
+ if DEBUG: print >> sys.stderr, 'emcc: LLVM dead globals elimination'
+ shared.Building.llvm_opt(in_temp(target_basename + '.bc'), ['-internalize', '-globaldce'])
# Emscripten
try:
@@ -531,6 +536,7 @@ try:
if not LEAVE_INPUTS_RAW:
final = in_temp(target_basename + '.bc')
+ if DEBUG: save_intermediate('bc', 'bc')
final = shared.Building.llvm_dis(final, final + '.ll')
if DEBUG: save_intermediate('ll', 'll')
else: