[PATCH] D129125: ManagedStatic: remove from PassTimingInfo

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 02:18:23 PDT 2022


nhaehnle created this revision.
nhaehnle added reviewers: efriedma, lattner.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nhaehnle requested review of this revision.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129125

Files:
  llvm/lib/IR/PassTimingInfo.cpp


Index: llvm/lib/IR/PassTimingInfo.cpp
===================================================================
--- llvm/lib/IR/PassTimingInfo.cpp
+++ llvm/lib/IR/PassTimingInfo.cpp
@@ -22,7 +22,6 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/FormatVariadic.h"
-#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/TypeName.h"
 #include "llvm/Support/raw_ostream.h"
@@ -92,8 +91,6 @@
   Timer *newPassTimer(StringRef PassID, StringRef PassDesc);
 };
 
-static ManagedStatic<sys::SmartMutex<true>> TimingInfoMutex;
-
 PassTimingInfo::PassTimingInfo()
     : TG("pass", "... Pass execution timing report ...") {}
 
@@ -110,8 +107,8 @@
   // Constructed the first time this is called, iff -time-passes is enabled.
   // This guarantees that the object will be constructed after static globals,
   // thus it will be destroyed before them.
-  static ManagedStatic<PassTimingInfo> TTI;
-  TheTimeInfo = &*TTI;
+  static PassTimingInfo TTI;
+  TheTimeInfo = &TTI;
 }
 
 /// Prints out timing information and then resets the timers.
@@ -133,7 +130,8 @@
     return nullptr;
 
   init();
-  sys::SmartScopedLock<true> Lock(*TimingInfoMutex);
+  static sys::SmartMutex<true> TimingInfoMutex;
+  sys::SmartScopedLock<true> Lock(TimingInfoMutex);
   std::unique_ptr<Timer> &T = TimingData[Pass];
 
   if (!T) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129125.442226.patch
Type: text/x-patch
Size: 1391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220705/f4ce1f38/attachment.bin>


More information about the llvm-commits mailing list