@@ -139,7 +139,7 @@ Options that are modified or new in %s include:
139
139
-s DOUBLE_MODE=0
140
140
-s PRECISE_I64_MATH=0
141
141
--closure 1
142
- --llvm-lto 1
142
+ --llvm-lto 2
143
143
144
144
This is not recommended at all. A better idea
145
145
is to try each of these separately on top of
@@ -215,11 +215,14 @@ Options that are modified or new in %s include:
215
215
2: -O2 LLVM optimizations
216
216
3: -O3 LLVM optimizations (default in -O2+)
217
217
218
- --llvm-lto <level> 0: No LLVM LTO (default in -O2 and below )
219
- 1: LLVM LTO (default in -O3)
218
+ --llvm-lto <level> 0: No LLVM LTO (default)
219
+ 1: LLVM LTO is performed
220
220
Note: If LLVM optimizations are not run
221
221
(see --llvm-opts), setting this to 1 has no
222
222
effect.
223
+ 2: LLVM LTO is performed, and we supplement it
224
+ with pre-running LLVM opt -O3 on the full
225
+ combined bitcode
223
226
224
227
--closure <on> 0: No closure compiler (default in -O2 and below)
225
228
1: Run closure compiler. This greatly reduces
879
882
newargs = newargs + [default_cxx_std ]
880
883
881
884
if llvm_opts is None : llvm_opts = LLVM_OPT_LEVEL [opt_level ]
882
- if llvm_lto is None : llvm_lto = opt_level >= 3
885
+ if llvm_lto is None and opt_level >= 3 : llvm_lto = 2
883
886
if opt_level == 0 : debug_level = 4
884
887
if closure is None and opt_level == 3 : closure = True
885
888
@@ -1419,6 +1422,11 @@ try:
1419
1422
if not LEAVE_INPUTS_RAW :
1420
1423
link_opts = [] if debug_level >= 4 else ['-strip-debug' ] # remove LLVM debug if we are not asked for it
1421
1424
1425
+ if llvm_lto >= 2 :
1426
+ logging .debug ('running LLVM opt -O3 as pre-LTO' )
1427
+ shared .Building .llvm_opt (in_temp (target_basename + '.bc' ), ['-O3' ])
1428
+ if DEBUG : save_intermediate ('opt' , 'bc' )
1429
+
1422
1430
if shared .Building .can_build_standalone ():
1423
1431
# If we can LTO, do it before dce, since it opens up dce opportunities
1424
1432
if llvm_lto and shared .Building .can_use_unsafe_opts ():
0 commit comments