[llvm] Make WriteIndexesThinBackend multi threaded (PR #109847)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 10:38:36 PDT 2024
================
@@ -1645,19 +1648,48 @@ class WriteIndexesThinBackend : public ThinBackendProc {
*LinkedObjectsFile << LinkedObjectsFilePath << '\n';
}
- if (auto E = emitFiles(ImportList, ModulePath, NewModulePath))
- return E;
+ BackendThreadPool.async(
+ [this](const StringRef ModulePath,
+ const FunctionImporter::ImportMapTy &ImportList,
+ const std::string &OldPrefix, const std::string &NewPrefix) {
+ std::string NewModulePath =
+ getThinLTOOutputFile(ModulePath, OldPrefix, NewPrefix);
+ auto E = emitFiles(ImportList, ModulePath, NewModulePath);
+ if (E) {
+ std::unique_lock<std::mutex> L(ErrMu);
+ if (Err)
+ Err = joinErrors(std::move(*Err), std::move(E));
+ else
+ Err = std::move(E);
+ return;
+ }
+ if (OnWrite) {
----------------
teresajohnson wrote:
The InProcessThinBackend handles this by calling OnWrite after the async invocation. Can we use the same approach here?
https://github.com/llvm/llvm-project/pull/109847
More information about the llvm-commits
mailing list