[llvm-branch-commits] [llvm] release/23.x: [DWARFLinker] Make synthetic type names deterministic under threading (#209553) (PR #210834)

Douglas Yung via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 22 06:57:35 PDT 2026


https://github.com/dyung updated https://github.com/llvm/llvm-project/pull/210834

>From 2462eac065b11a3283d2247af841f33c4c4be477 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Sun, 19 Jul 2026 15:58:34 -0500
Subject: [PATCH] [DWARFLinker] Make synthetic type names deterministic under
 threading (#209553)

(cherry picked from commit 6bcdcb39c57ea926d3082ec3ecae74bf59b4658e)
---
 .../DWARFLinker/Parallel/SyntheticTypeNameBuilder.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/DWARFLinker/Parallel/SyntheticTypeNameBuilder.cpp b/llvm/lib/DWARFLinker/Parallel/SyntheticTypeNameBuilder.cpp
index b5be5d498ed3e..c3d8a2489de9a 100644
--- a/llvm/lib/DWARFLinker/Parallel/SyntheticTypeNameBuilder.cpp
+++ b/llvm/lib/DWARFLinker/Parallel/SyntheticTypeNameBuilder.cpp
@@ -405,10 +405,13 @@ Error SyntheticTypeNameBuilder::addDIETypeName(
   // Check if DIE already has a name.
   if (!TypeEntryPtr) {
     size_t NameStart = SyntheticName.size();
-    if (AssignNameToTypeDescriptor) {
-      if (Error Err = addParentName(*UnitEntryPair))
-        return Err;
-    }
+    // Prepend the parent scope so this name matches the key the type is
+    // stored under in the pool (the getKey() branch below). Otherwise the
+    // same type gets different names depending on whether it already has a
+    // pool entry, which races under parallel assignment and breaks
+    // deterministic deduplication.
+    if (Error Err = addParentName(*UnitEntryPair))
+      return Err;
     addTypePrefix(UnitEntryPair->DieEntry);
 
     if (ChildIndex) {



More information about the llvm-branch-commits mailing list