1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
llvm-mirror/lib/LTO
Alexandre Ganea 41c38f2370 Re-land [ThinLTO] Re-order modules for optimal multi-threaded processing
This reverts 9b5b3050237db3642ed7ab1bdb3ffa2202511b99 and fixes the unwanted re-ordering when generating ThinLTO indexes.

The goal of this patch is to better balance thread utilization during ThinLTO in-process linking (in llvm-lto2 or in LLD). Before this patch, large modules would often be scheduled late during execution, taking a long time to complete, thus starving the thread pool.

We now sort modules in descending order, based on each module's bitcode size, so that larger modules are processed first. By doing so, smaller modules have a better chance to keep the thread pool active, and thus avoid starvation when the bitcode compilation is almost complete.

In our case (on dual Intel Xeon Gold 6140, Windows 10 version 2004, two-stage build), this saves 15 sec when linking `clang.exe` with LLD & -flto=thin, /opt:lldltojobs=all, no ThinLTO cache, -DLLVM_INTEGRATED_CRT_ALLOC=d:\git\rpmalloc.

Before patch: 100 sec
After patch: 85 sec

Inspired by the work done by David Callahan in D60495.

Differential Revision: https://reviews.llvm.org/D87966
2020-10-13 21:54:15 -04:00
..
Caching.cpp
CMakeLists.txt
LLVMBuild.txt
LTO.cpp Re-land [ThinLTO] Re-order modules for optimal multi-threaded processing 2020-10-13 21:54:15 -04:00
LTOBackend.cpp [ThinLTO] Option to bypass function importing. 2020-09-22 13:12:11 -07:00
LTOCodeGenerator.cpp [LTO] Don't apply LTOPostLink module flag during writeMergedModule 2020-08-26 11:17:45 -07:00
LTOModule.cpp Remove GlobalValue::getAlignment(). 2020-06-23 19:13:42 -07:00
SummaryBasedOptimizations.cpp
ThinLTOCodeGenerator.cpp Re-land [ThinLTO] Re-order modules for optimal multi-threaded processing 2020-10-13 21:54:15 -04:00
UpdateCompilerUsed.cpp TargetLowering.h - remove unnecessary TargetMachine.h include. NFC 2020-05-23 19:49:38 +01:00