[llvm] [BOLT] fix race condition in multi-threaded DWO type unit processing (PR #197359)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 19:57:33 PDT 2026


================
@@ -328,7 +395,12 @@ void DIEBuilder::buildCompileUnits(const std::vector<DWARFUnit *> &CUs) {
 void DIEBuilder::buildDWOUnit(DWARFUnit &U) {
   BuilderState.release();
   BuilderState = std::make_unique<State>();
-  buildTypeUnits(nullptr, false);
+  if (DwarfContext->isDWP()) {
+    std::unique_lock<std::mutex> LockGuard(BC.getUnitsMutex());
----------------
ayermolo wrote:

Please move into callee.
Also since DWP context is shared, we are affectively serializing this whole thing due to type parsing. I haven't had a chance to look at https://github.com/llvm/llvm-project/pull/197859, so maybe it's improved there?

https://github.com/llvm/llvm-project/pull/197359


More information about the llvm-commits mailing list