[PATCH] D131059: [Timer][Statistics] Make global constructor ordering more robust
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 25 10:10:32 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaf2e54992de9: [Timer][Statistics] Make global constructor ordering more robust (authored by nhaehnle).
Changed prior to commit:
https://reviews.llvm.org/D131059?vs=449597&id=455633#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131059/new/
https://reviews.llvm.org/D131059
Files:
llvm/include/llvm/Support/Timer.h
llvm/lib/Support/Statistic.cpp
llvm/lib/Support/Timer.cpp
Index: llvm/lib/Support/Timer.cpp
===================================================================
--- llvm/lib/Support/Timer.cpp
+++ llvm/lib/Support/Timer.cpp
@@ -499,7 +499,8 @@
return delim;
}
-void TimerGroup::ConstructTimerLists() {
+void TimerGroup::constructForStatistics() {
+ (void)getLibSupportInfoOutputFilename();
(void)*NamedGroupedTimers;
}
Index: llvm/lib/Support/Statistic.cpp
===================================================================
--- llvm/lib/Support/Statistic.cpp
+++ llvm/lib/Support/Statistic.cpp
@@ -120,8 +120,9 @@
}
StatisticInfo::StatisticInfo() {
- // Ensure timergroup lists are created first so they are destructed after us.
- TimerGroup::ConstructTimerLists();
+ // Ensure that necessary timer global objects are created first so they are
+ // destructed after us.
+ TimerGroup::constructForStatistics();
}
// Print information when destroyed, iff command line option is specified.
Index: llvm/include/llvm/Support/Timer.h
===================================================================
--- llvm/include/llvm/Support/Timer.h
+++ llvm/include/llvm/Support/Timer.h
@@ -231,10 +231,10 @@
/// Prints all timers as JSON key/value pairs.
static const char *printAllJSONValues(raw_ostream &OS, const char *delim);
- /// Ensure global timer group lists are initialized. This function is mostly
- /// used by the Statistic code to influence the construction and destruction
- /// order of the global timer lists.
- static void ConstructTimerLists();
+ /// Ensure global objects required for statistics printing are initialized.
+ /// This function is used by the Statistic code to ensure correct order of
+ /// global constructors and destructors.
+ static void constructForStatistics();
/// This makes the default group unmanaged, and lets the user manage the
/// group's lifetime.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131059.455633.patch
Type: text/x-patch
Size: 1874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220825/8b407d73/attachment-0001.bin>
More information about the llvm-commits
mailing list