This gives our worker threads some names that allow easily identifying them in tools such as profilers and debuggers.
Differential Revision: https://reviews.llvm.org/D144297
#include "llvm/Config/llvm-config.h"
#if LLVM_ENABLE_THREADS
+#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Threading.h"
#else
#include "llvm/Support/raw_ostream.h"
while (static_cast<int>(Threads.size()) < newThreadCount) {
int ThreadID = Threads.size();
Threads.emplace_back([this, ThreadID] {
+ set_thread_name(formatv("llvm-worker-{0}", ThreadID));
Strategy.apply_thread_strategy(ThreadID);
processTasks(nullptr);
});