[llvm] f5b8a31 - [ThinLTO] Add TimeTrace for Thinlink step
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 3 13:20:21 PDT 2021
Author: modimo
Date: 2021-08-03T13:20:04-07:00
New Revision: f5b8a3125aa82a777f4037786a32fb73ebc303b0
URL: https://github.com/llvm/llvm-project/commit/f5b8a3125aa82a777f4037786a32fb73ebc303b0
DIFF: https://github.com/llvm/llvm-project/commit/f5b8a3125aa82a777f4037786a32fb73ebc303b0.diff
LOG: [ThinLTO] Add TimeTrace for Thinlink step
Results from Clang self-build:
{F17435948}
Testing:
ninja check-all
Reviewed By: anton-afanasyev
Differential Revision: https://reviews.llvm.org/D104428
Added:
Modified:
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
Removed:
################################################################################
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 69d500ba9bce..deb367bd5aa6 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/LTO/LTO.h"
+#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
@@ -1398,6 +1399,11 @@ ThinBackend lto::createWriteIndexesThinBackend(
Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache,
const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols) {
+ timeTraceProfilerBegin("ThinLink", StringRef(""));
+ auto TimeTraceScopeExit = llvm::make_scope_exit([]() {
+ if (llvm::timeTraceProfilerEnabled())
+ llvm::timeTraceProfilerEnd();
+ });
if (ThinLTO.ModuleMap.empty())
return Error::success();
@@ -1512,6 +1518,11 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache,
generateParamAccessSummary(ThinLTO.CombinedIndex);
+ if (llvm::timeTraceProfilerEnabled())
+ llvm::timeTraceProfilerEnd();
+
+ TimeTraceScopeExit.release();
+
std::unique_ptr<ThinBackendProc> BackendProc =
ThinLTO.Backend(Conf, ThinLTO.CombinedIndex, ModuleToDefinedGVSummaries,
AddStream, Cache);
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index a633dd1a51aa..c78712206292 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -14,6 +14,7 @@
#include "llvm/LTO/legacy/ThinLTOCodeGenerator.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/AliasAnalysis.h"
@@ -996,6 +997,11 @@ ThinLTOCodeGenerator::writeGeneratedObject(int count, StringRef CacheEntryPath,
// Main entry point for the ThinLTO processing
void ThinLTOCodeGenerator::run() {
+ timeTraceProfilerBegin("ThinLink", StringRef(""));
+ auto TimeTraceScopeExit = llvm::make_scope_exit([]() {
+ if (llvm::timeTraceProfilerEnabled())
+ llvm::timeTraceProfilerEnd();
+ });
// Prepare the resulting object vector
assert(ProducedBinaries.empty() && "The generator should not be reused");
if (SavedObjectsDirectoryPath.empty())
@@ -1141,6 +1147,11 @@ void ThinLTOCodeGenerator::run() {
ModulesVec.push_back(&Mod->getSingleBitcodeModule());
std::vector<int> ModulesOrdering = lto::generateModulesOrdering(ModulesVec);
+ if (llvm::timeTraceProfilerEnabled())
+ llvm::timeTraceProfilerEnd();
+
+ TimeTraceScopeExit.release();
+
// Parallel optimizer + codegen
{
ThreadPool Pool(heavyweight_hardware_concurrency(ThreadCount));
More information about the llvm-commits
mailing list