@@ -74,10 +74,18 @@ This flag may take one of the following values:
74
74
This is similar to "fat", but takes substantially less time to run while
75
75
still achieving performance gains similar to "fat".
76
76
77
- If ` -C lto ` is not specified, then the compiler will attempt to perform "thin local LTO"
78
- which performs "thin" LTO on the local crate only across its [ codegen
79
- units] ( #codegen-units ) . In this case, LTO is disabled if codegen units is 1 or
80
- optimizations are disabled ([ ` -C opt-level=0 ` ] ( #opt-level ) ).
77
+ If ` -C lto ` is not specified, then the compiler will attempt to perform "thin
78
+ local LTO" which performs "thin" LTO on the local crate only across its
79
+ [ codegen units] ( #codegen-units ) . When ` -C lto ` is not specified, LTO is
80
+ disabled if codegen units is 1 or optimizations are disabled ([ `-C
81
+ opt-level=0`] ( #opt-level ) ). That is:
82
+
83
+ * When ` -C lto ` is not specified:
84
+ * ` codegen-units=1 ` : Disables LTO.
85
+ * ` opt-level=0 ` : Disables LTO.
86
+ * When ` -C lto=true ` :
87
+ * ` lto=true ` : 16 codegen units, performs fat LTO across crates.
88
+ * ` codegen-units=1 ` + ` lto=true ` : 1 codegen unit, fat LTO across crates.
81
89
82
90
See also [ linker-plugin-lto] ( #linker-plugin-lto ) for cross-language LTO.
83
91
@@ -237,14 +245,17 @@ flag][option-emit] for more information.
237
245
238
246
## codegen-units
239
247
240
- This flag lets you control how many threads are used when doing code
241
- generation. It takes an integer greater than 0.
248
+ This flag controls how many code generation units the crate is split into. It
249
+ takes an integer greater than 0.
242
250
243
- Increasing parallelism may speed up compile times, but may also produce slower
244
- code. Setting this to 1 may improve the performance of generated code, but may
245
- be slower to compile.
251
+ When a crate is split into multiple codegen units, LLVM is able to process
252
+ them in parallel. Increasing parallelism may speed up compile times, but may
253
+ also produce slower code. Setting this to 1 may improve the performance of
254
+ generated code, but may be slower to compile.
246
255
247
- The default, if not specified, is 16.
256
+ The default, if not specified, is 16. This flag is ignored if
257
+ [ incremental] ( #incremental ) is enabled, in which case an internal heuristic is
258
+ used to split the crate.
248
259
249
260
## remark
250
261
0 commit comments