aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authormodimo <modimo@fb.com>2021-08-03 13:18:57 -0700
committermodimo <modimo@fb.com>2021-08-03 13:20:04 -0700
commitf5b8a3125aa82a777f4037786a32fb73ebc303b0 (patch)
tree929337f716e77227371ec070db33524ce66c6751 /llvm/lib/LTO/LTO.cpp
parent871ea69803b1f231254ab0c560795a33b6ed0c77 (diff)
downloadllvm-f5b8a3125aa82a777f4037786a32fb73ebc303b0.zip
llvm-f5b8a3125aa82a777f4037786a32fb73ebc303b0.tar.gz
llvm-f5b8a3125aa82a777f4037786a32fb73ebc303b0.tar.bz2
[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
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 69d500b..deb367b 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);