[llvm] 2bbcf15 - [Support] Fix time trace multi threaded support with LLVM_ENABLE_THREADS=OFF

Russell Gallop via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 00:43:12 PST 2019


Author: Russell Gallop
Date: 2019-12-17T08:42:56Z
New Revision: 2bbcf156acc157377e814fbb1828a9fe89367ea2

URL: https://github.com/llvm/llvm-project/commit/2bbcf156acc157377e814fbb1828a9fe89367ea2
DIFF: https://github.com/llvm/llvm-project/commit/2bbcf156acc157377e814fbb1828a9fe89367ea2.diff

LOG: [Support] Fix time trace multi threaded support with LLVM_ENABLE_THREADS=OFF

Following on from 8ddcd1dc26ba, which added the support. As pointed out
on D71059 this does not build on some systems with LLVM_ENABLE_THREADS=OFF.

Differential Revision: https://reviews.llvm.org/D71548

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/TimeProfiler.h b/llvm/include/llvm/Support/TimeProfiler.h
index f43893a6d931..b20454242627 100644
--- a/llvm/include/llvm/Support/TimeProfiler.h
+++ b/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.

diff  --git a/llvm/lib/Support/TimeProfiler.cpp b/llvm/lib/Support/TimeProfiler.cpp
index 47091221a788..ec01c6f2f7e3 100644
--- a/llvm/lib/Support/TimeProfiler.cpp
+++ b/llvm/lib/Support/TimeProfiler.cpp
@@ -33,8 +33,7 @@ std::vector<std::unique_ptr<llvm::TimeTraceProfiler>>
 
 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;


        


More information about the llvm-commits mailing list