radeon-llvm: Start multithreaded before using llvm.
[mesa.git] / src / gallium / drivers / radeon / radeon_llvm_emit.cpp
index 89130b33157404763e49ed1975086981f96b0eb8..eef55a8e93afc47e2f36a2d2ebb2331acd195cf2 100644 (file)
@@ -35,6 +35,7 @@
 #include <llvm/Support/SourceMgr.h>
 #include <llvm/Support/TargetRegistry.h>
 #include <llvm/Support/TargetSelect.h>
+#include <llvm/Support/Threading.h>
 #include <llvm/Target/TargetData.h>
 #include <llvm/Target/TargetMachine.h>
 
@@ -57,6 +58,20 @@ void LLVMInitializeAMDGPUTargetInfo(void);
 }
 #endif
 
+namespace {
+
+class LLVMEnsureMultithreaded {
+public:
+   LLVMEnsureMultithreaded()
+   {
+      llvm_start_multithreaded();
+   }
+};
+
+static LLVMEnsureMultithreaded lLVMEnsureMultithreaded;
+
+}
+
 /**
  * Compile an LLVM module to machine code.
  *