[llvm] [DebugInfo] (Always) include the dwo name in the hash (PR #100375)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 09:43:09 PDT 2024


================
@@ -1294,11 +1287,13 @@ void DwarfDebug::finalizeModuleInfo() {
                                          ? dwarf::DW_AT_dwo_name
                                          : dwarf::DW_AT_GNU_dwo_name;
       finishUnitAttributes(TheCU.getCUNode(), TheCU);
-      TheCU.addString(TheCU.getUnitDie(), attrDWOName,
-                      Asm->TM.Options.MCOptions.SplitDwarfFile);
-      SkCU->addString(SkCU->getUnitDie(), attrDWOName,
-                      Asm->TM.Options.MCOptions.SplitDwarfFile);
-      // Emit a unique identifier for this CU.
+      StringRef DWOName = Asm->TM.Options.MCOptions.SplitDwarfFile;
+      TheCU.addString(TheCU.getUnitDie(), attrDWOName, DWOName);
+      SkCU->addString(SkCU->getUnitDie(), attrDWOName, DWOName);
+      // Emit a unique identifier for this CU. Include the DWO file name in the
+      // hash to avoid the case where two (almost) empty compile units have the
+      // same file. This can happen if link-time optimization removes nearly all
----------------
dwblaikie wrote:

"have the same contents" (rather than "have the same file")

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


More information about the llvm-commits mailing list