[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


================
@@ -110,6 +111,15 @@ class alignas(8) CompileUnit : public DwarfUnit {
   /// Returns DWARFFile containing this compile unit.
   const DWARFFile &getContaingFile() const { return File; }
 
+  /// Set deterministic priority for type DIE allocation ordering.
+  /// Lower priority values win when multiple CUs race to define the same type.
+  void setDeterministicPriority(unsigned ObjFileIdx, unsigned LocalIdx) {
+    assert(ObjFileIdx < (1u << 16) && LocalIdx < (1u << 16) &&
+           "priority encoding overflow");
----------------
alx32 wrote:

Possible concern: Is 64k+ CUs something that can come up in practice ? If yes, consider making this a non-assert build warning or increasing the indexes to 32b + 32b

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


More information about the llvm-commits mailing list