Index: llvm/lib/LTO/LTO.cpp =================================================================== --- llvm/lib/LTO/LTO.cpp +++ llvm/lib/LTO/LTO.cpp @@ -1398,6 +1398,7 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache, const DenseSet &GUIDPreservedSymbols) { + timeTraceProfilerBegin("ThinLink", StringRef("")); if (ThinLTO.ModuleMap.empty()) return Error::success(); @@ -1512,6 +1513,9 @@ generateParamAccessSummary(ThinLTO.CombinedIndex); + if (llvm::timeTraceProfilerEnabled()) + llvm::timeTraceProfilerEnd(); + std::unique_ptr BackendProc = ThinLTO.Backend(Conf, ThinLTO.CombinedIndex, ModuleToDefinedGVSummaries, AddStream, Cache); Index: llvm/lib/LTO/ThinLTOCodeGenerator.cpp =================================================================== --- llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -996,6 +996,7 @@ // Main entry point for the ThinLTO processing void ThinLTOCodeGenerator::run() { + timeTraceProfilerBegin("ThinLink", StringRef("")); // Prepare the resulting object vector assert(ProducedBinaries.empty() && "The generator should not be reused"); if (SavedObjectsDirectoryPath.empty()) @@ -1141,6 +1142,9 @@ ModulesVec.push_back(&Mod->getSingleBitcodeModule()); std::vector ModulesOrdering = lto::generateModulesOrdering(ModulesVec); + if (llvm::timeTraceProfilerEnabled()) + llvm::timeTraceProfilerEnd(); + // Parallel optimizer + codegen { ThreadPool Pool(heavyweight_hardware_concurrency(ThreadCount));