[llvm] [DWARFLinker] Make ODR uniquing deterministic (PR #194777)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 06:02:13 PDT 2026


================
@@ -1419,46 +1419,42 @@ DIE *CompileUnit::allocateTypeDie(TypeEntryBody *TypeDescriptor,
                                   DIEGenerator &TypeDIEGenerator,
                                   dwarf::Tag DieTag, bool IsDeclaration,
                                   bool IsParentDeclaration) {
-  DIE *DefinitionDie = TypeDescriptor->Die;
-  // Do not allocate any new DIE if definition DIE is already met.
-  if (DefinitionDie)
-    return nullptr;
-
-  DIE *DeclarationDie = TypeDescriptor->DeclarationDie;
-  bool OldParentIsDeclaration = TypeDescriptor->ParentIsDeclaration;
-
-  if (IsDeclaration && !DeclarationDie) {
-    // Alocate declaration DIE.
-    DIE *NewDie = TypeDIEGenerator.createDIE(DieTag, 0);
-    if (TypeDescriptor->DeclarationDie.compare_exchange_strong(DeclarationDie,
-                                                               NewDie))
-      return NewDie;
-  } else if (IsDeclaration && !IsParentDeclaration && OldParentIsDeclaration) {
-    // Overwrite existing declaration DIE if it's parent is also an declaration
----------------
alx32 wrote:

Is this Overwrite still possible in the new code ? If not - is that an intentional behavior change ? 
If we don't want this behavior - I don't think `TypeDescriptor->ParentIsDeclaration` is used anymore and can be removed. 

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


More information about the llvm-commits mailing list