diff --git a/llvm/lib/Support/TimeProfiler.cpp b/llvm/lib/Support/TimeProfiler.cpp --- a/llvm/lib/Support/TimeProfiler.cpp +++ b/llvm/lib/Support/TimeProfiler.cpp @@ -271,6 +271,7 @@ // Called from main thread. void llvm::timeTraceProfilerCleanup() { delete TimeTraceProfilerInstance; + TimeTraceProfilerInstance = nullptr; std::lock_guard Lock(Mu); for (auto *TTP : *ThreadTimeTraceProfilerInstances) delete TTP;