<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/77524>77524</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Support split LTO units with Unified LTO
</td>
</tr>
<tr>
<th>Labels</th>
<td>
bug,
LTO
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ilovepi
</td>
</tr>
</table>
<pre>
When investigating https://github.com/llvm/llvm-project/issues/70703, we discovered that Unified LTO doesn't work w/ split LTO units.
To quote from that issue:
```
If you run Unified LTO with split LTO units enabled, empty module IDs mean that some modules will be written as regular LTO modules, and some will be written as ThinLTO modules. Unified LTO wants all modules to be either ThinLTO or regular LTO modules so that the whole program can be optimized as one piece.
```
@ormris posted https://reviews.llvm.org/D123969 to address the module ID problem, however, there were some concerns about correctness (see https://reviews.llvm.org/D123969#3460023).
I think Unified LTO should be able to work with split LTO units, regardless of the Module Id issue. Using the same format and pre-link optimization pipeline shouldn't prevent orthogonal LTO features from working (at least from what I can tell). If I'm wrong, and it is fundamentally incompatible then we need to document that, and take a look at both WPD and CFI implementations to determine if they can be made to work w/o split LTO units.
I'm not exactly clear on what we'd need to do to make Unified LTO work as expected and support important optimizations like WPD and security hardening measures like CFI.
I'm CCing folks from the previous discussion.
CC: @mandlebug @ormris @nikic @petrhosek @teresajohnson
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVVGL4zgM_jXui9iSOu20eejDXodCYY89uFn2WYmVxFvHytlKs71ff9jtzM4Mw3FwUFwHy9In6ftkjNF2nmivNr-pzeMCJ-k57K3jC412UbO57r_35MH6C0WxHYr1HfQiY1TlZ6WPSh87K_1ULxselD46d3n--zQG_kGNKH20MU4UlT5ui21RKn2AmcDY2PCFAhmQHgW-edtaMvDl6SsYpuiV3grMHM4wK32EODor-XTyVuJSFY-q-Hxbnxj-mlgI2sDDzV2OqcrPcLd7KO6__Hlq4coThMm_iTtb6d8HA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