Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ThinLTO][LowerTypeTests] Don't compute address taken set unless CFI …
…(NFC) (llvm#118508) The AddressTaken set used for CFI with regular LTO was being computed on the ExportSummary regardless of whether any CFI metadata existed. In the case of ThinLTO, the ExportSummary is the global summary index for the target, and the lack of guard in this code meant this was being computed on the ThinLTO index even when there was an empty regular LTO module, since the backend is called on the combined module to generate the expected output file (normally this is trivial as there is no IR). Move the computation of the AddressTaken set into the condition checking for CFI to avoid this overhead. This change resulted in a 20% speedup in the thin link of a large target. It looks like the outer loop has existed here for several years, but likely became a larger overhead after the inner loop was added very recently in PR113987. I will send a separate patch to refactor the ThinLTO backend handling to avoid invoking the opt pipeline if the module is empty, in case there are other summary-based analyses in some of the passes now or in the future. This change is still desireable as by default regular LTO modules contain summaries, or we can have split thin and regular LTO modules, and if they don't involve CFI these would still unnecessarily compute the AddressTaken set.
- Loading branch information