DTLTO Cache optimization Currently, DTLTO cache works this way: when native object file is generated and sent back by the remote compilation, it's being saved on the disk, then the content of this file is read and written into a buffer and subsequently it's read from the buffer and written into the cache file. This is obviously non-efficient. With this optimization, after the native object file is saved on the disk, it's being renamed into a cache file. GitOrigin-RevId: c562f17fe5607e94f85a996fd631803f3ba71122
diff --git a/COFF/LTO.cpp b/COFF/LTO.cpp index f85a260..0e335d6 100644 --- a/COFF/LTO.cpp +++ b/COFF/LTO.cpp
@@ -216,7 +216,8 @@ FileCache cache; if (!ctx.config.ltoCache.empty()) cache = check(localCache("ThinLTO", "Thin", ctx.config.ltoCache, - createAddBufferFn(files, file_names))); + createAddBufferFn(files, file_names), + !ctx.config.dtltoDistributor.empty())); checkError(ltoObj->run( [&](size_t task, const Twine &moduleName) {
diff --git a/ELF/LTO.cpp b/ELF/LTO.cpp index a116811..f76d605 100644 --- a/ELF/LTO.cpp +++ b/ELF/LTO.cpp
@@ -341,7 +341,8 @@ FileCache cache; if (!ctx.arg.thinLTOCacheDir.empty()) cache = check(localCache("ThinLTO", "Thin", ctx.arg.thinLTOCacheDir, - createAddBufferFn(files, filenames))); + createAddBufferFn(files, filenames), + !ctx.arg.dtltoDistributor.empty())); if (!ctx.bitcodeFiles.empty()) checkError(ctx.e, ltoObj->run(