[PATCH] D71548: Fix time trace multi threaded support with LLVM_ENABLE_THREADS=OFF

Russell Gallop via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 07:01:54 PST 2019


russell.gallop created this revision.
russell.gallop added reviewers: anton-afanasyev, Quuxplusone, Kai.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Following on from https://reviews.llvm.org/rG8ddcd1dc26bad9d97bbf34cf4fc91dbf3c153431.

As pointed out here: https://reviews.llvm.org/D71059 this does not build on some systems with LLVM_ENABLE_THREADS=OFF.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71548

Files:
  llvm/include/llvm/Support/TimeProfiler.h
  llvm/lib/Support/TimeProfiler.cpp


Index: llvm/lib/Support/TimeProfiler.cpp
===================================================================
--- llvm/lib/Support/TimeProfiler.cpp
+++ llvm/lib/Support/TimeProfiler.cpp
@@ -33,8 +33,7 @@
 
 namespace llvm {
 
-thread_local std::unique_ptr<TimeTraceProfiler> TimeTraceProfilerInstance =
-    nullptr;
+LLVM_THREAD_LOCAL std::unique_ptr<TimeTraceProfiler> TimeTraceProfilerInstance;
 
 typedef duration<steady_clock::rep, steady_clock::period> DurationType;
 typedef time_point<steady_clock> TimePointType;
Index: llvm/include/llvm/Support/TimeProfiler.h
===================================================================
--- llvm/include/llvm/Support/TimeProfiler.h
+++ llvm/include/llvm/Support/TimeProfiler.h
@@ -14,7 +14,7 @@
 namespace llvm {
 
 struct TimeTraceProfiler;
-extern thread_local std::unique_ptr<TimeTraceProfiler>
+extern LLVM_THREAD_LOCAL std::unique_ptr<TimeTraceProfiler>
     TimeTraceProfilerInstance;
 
 /// Initialize the time trace profiler.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71548.234054.patch
Type: text/x-patch
Size: 984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191216/18fb4b71/attachment.bin>


More information about the llvm-commits mailing list