aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-18 12:31:45 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-18 12:31:45 -0800
commite7c773654dcf02af4ac8d80f9ea29683b911b668 (patch)
tree716564b8ce1ec572321883a7fed8213860e0f681 /emcc
parent9aa0797ea013ccd0a91c78c9e6c83d1f42cba3c3 (diff)
use llvm internalive and globaldce to remove unneeded code before compiling to js
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: