aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Timer.cpp
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2022-08-03 10:56:10 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2022-08-25 19:09:49 +0200
commitaf2e54992de969f3ec75e397f1840068c2ebd060 (patch)
tree65923f98de98fd791d26907df28d7fd780a54e85 /llvm/lib/Support/Timer.cpp
parent51d82502d98d3c5d60606e63b6c23bb5759fdb91 (diff)
downloadllvm-af2e54992de969f3ec75e397f1840068c2ebd060.zip
llvm-af2e54992de969f3ec75e397f1840068c2ebd060.tar.gz
llvm-af2e54992de969f3ec75e397f1840068c2ebd060.tar.bz2
[Timer][Statistics] Make global constructor ordering more robust
It was observed in D129117 that the subtle dependency between statistic and timer code is not entirely robust: the global destructor ~StatisticInfo indirectly calls CreateInfoOutputFile, which requires the LibSupportInfoOutputFilename to not have been destructed. By constructing LibSupportInfoOutputFilename before the StatisticInfo object, the order of destruction is guaranteed. Differential Revision: https://reviews.llvm.org/D131059
Diffstat (limited to 'llvm/lib/Support/Timer.cpp')
-rw-r--r--llvm/lib/Support/Timer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp
index 08e1a8a..c1b0fdb 100644
--- a/llvm/lib/Support/Timer.cpp
+++ b/llvm/lib/Support/Timer.cpp
@@ -499,7 +499,8 @@ const char *TimerGroup::printAllJSONValues(raw_ostream &OS, const char *delim) {
return delim;
}
-void TimerGroup::ConstructTimerLists() {
+void TimerGroup::constructForStatistics() {
+ (void)getLibSupportInfoOutputFilename();
(void)*NamedGroupedTimers;
}