Deleting the temporary files produced by the DTLTO pipeline can be expensive on Windows hosts. For a Clang link (Debug build with sanitizers and instrumentation) using an optimized toolchain (PGO non-LTO, llvmorg-22.1.0) on a Windows 11 Pro (Build 26200), AMD Family 25 @ ~4.5 GHz, 16 cores/32 threads, 64 GB RAM machine, the mean duration of the "Remove DTLTO temporary files" time trace scope was 1267.789 ms (measured over 10 runs). This patch performs the deletions on a background thread, allowing them to overlap with the tail of the link to hide this cost. This is a re-implementation of the asynchronous cleanup idea from https://github.com/llvm/llvm-project/pull/186988, which had to be reverted in https://github.com/llvm/llvm-project/pull/189043 because cleanup was not guaranteed to complete before LLD invoked timeTraceProfilerCleanup(). In certain cases timeTraceProfilerCleanup() was called before temporary file deletion had completed in LLD, which caused memory leaks that were flagged by sanitizer builds. Note that the DTLTO implementation has been refactored heavily since https://github.com/llvm/llvm-project/pull/186988, so this is a re-implementation along the same lines. To solve the ordering issue, LLD now calls a hook that defaults to a no-op, and DTLTO overrides it to drain the background deletion work. LLD calls this hook before time-trace write/cleanup. |
||
|---|---|---|
| .. | ||
| CallGraphSort.cpp | ||
| CallGraphSort.h | ||
| Chunks.cpp | ||
| Chunks.h | ||
| CMakeLists.txt | ||
| COFFLinkerContext.cpp | ||
| COFFLinkerContext.h | ||
| Config.h | ||
| DebugTypes.cpp | ||
| DebugTypes.h | ||
| DLL.cpp | ||
| DLL.h | ||
| Driver.cpp | ||
| Driver.h | ||
| DriverUtils.cpp | ||
| ICF.cpp | ||
| ICF.h | ||
| InputFiles.cpp | ||
| InputFiles.h | ||
| LLDMapFile.cpp | ||
| LLDMapFile.h | ||
| LTO.cpp | ||
| LTO.h | ||
| MapFile.cpp | ||
| MapFile.h | ||
| MarkLive.cpp | ||
| MarkLive.h | ||
| MinGW.cpp | ||
| MinGW.h | ||
| Options.td | ||
| PDB.cpp | ||
| PDB.h | ||
| README.md | ||
| Symbols.cpp | ||
| Symbols.h | ||
| SymbolTable.cpp | ||
| SymbolTable.h | ||
| TypeMerger.h | ||
| Writer.cpp | ||
| Writer.h | ||
See docs/NewLLD.rst