[lld] [llvm] Make WriteIndexesThinBackend multi threaded (PR #109847)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 6 21:30:45 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff acf92a47c0ece8562fd745215c478fe2d4ab5896 33fb21bddd893ce28bd0de602ee0de37ff75d57e --extensions cpp,h -- lld/COFF/LTO.cpp lld/ELF/LTO.cpp lld/MachO/LTO.cpp llvm/include/llvm/LTO/LTO.h llvm/include/llvm/Support/Threading.h llvm/include/llvm/Transforms/IPO/FunctionImport.h llvm/lib/LTO/LTO.cpp llvm/lib/LTO/ThinLTOCodeGenerator.cpp llvm/lib/Transforms/IPO/FunctionImport.cpp llvm/tools/gold/gold-plugin.cpp llvm/tools/llvm-lto2/llvm-lto2.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 900dd2e2b1..ccf1139c03 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -1871,18 +1871,19 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache,
 
     if (BackendProcess->getThreadCount() == 1 ||
         BackendProcess->isSensitiveToInputOrder()) {
-      // Process the modules in the order they were provided on the command-line.
-      // It is important for this codepath to be used for WriteIndexesThinBackend,
-      // to ensure the emitted LinkedObjectsFile lists ThinLTO objects in the same
-      // order as the inputs, which otherwise would affect the final link order.
+      // Process the modules in the order they were provided on the
+      // command-line. It is important for this codepath to be used for
+      // WriteIndexesThinBackend, to ensure the emitted LinkedObjectsFile lists
+      // ThinLTO objects in the same order as the inputs, which otherwise would
+      // affect the final link order.
       for (int I = 0, E = ModuleMap.size(); I != E; ++I)
         if (Error E = ProcessOneModule(I))
           return E;
     } else {
       // When executing in parallel, process largest bitsize modules first to
       // improve parallelism, and avoid starving the thread pool near the end.
-      // This saves about 15 sec on a 36-core machine while link `clang.exe` (out
-      // of 100 sec).
+      // This saves about 15 sec on a 36-core machine while link `clang.exe`
+      // (out of 100 sec).
       std::vector<BitcodeModule *> ModulesVec;
       ModulesVec.reserve(ModuleMap.size());
       for (auto &Mod : ModuleMap)

``````````

</details>


https://github.com/llvm/llvm-project/pull/109847


More information about the llvm-commits mailing list