[llvm] 560ab1f - DebugInfo: Pull out a common expression.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 20:09:10 PST 2019


Author: David Blaikie
Date: 2019-12-05T19:51:30-08:00
New Revision: 560ab1f8d33c03eb5c855930d0fdc0ef95c52744

URL: https://github.com/llvm/llvm-project/commit/560ab1f8d33c03eb5c855930d0fdc0ef95c52744
DIFF: https://github.com/llvm/llvm-project/commit/560ab1f8d33c03eb5c855930d0fdc0ef95c52744.diff

LOG: DebugInfo: Pull out a common expression.

This is for the case where -gmlt -gsplit-dwarf -fsplit-dwarf-inlining
are used together in some but not all units during LTO (or, in the
reduced case, even without LTO) - ensuring that no split dwarf is used
(because split-dwarf-inlining puts the same data in the .o file, so
there's no need to duplicate it into the .dwo file)

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 1e669d87dbc2..0aa4ae3958eb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1104,7 +1104,10 @@ void DwarfDebug::finalizeModuleInfo() {
     // If we're splitting the dwarf out now that we've got the entire
     // CU then add the dwo id to it.
     auto *SkCU = TheCU.getSkeleton();
-    if (useSplitDwarf() && !TheCU.getUnitDie().children().empty()) {
+
+    bool HasSplitUnit = SkCU && !TheCU.getUnitDie().children().empty();
+
+    if (HasSplitUnit) {
       finishUnitAttributes(TheCU.getCUNode(), TheCU);
       TheCU.addString(TheCU.getUnitDie(), dwarf::DW_AT_GNU_dwo_name,
                       Asm->TM.Options.MCOptions.SplitDwarfFile);
@@ -1155,8 +1158,7 @@ void DwarfDebug::finalizeModuleInfo() {
     // We don't keep track of which addresses are used in which CU so this
     // is a bit pessimistic under LTO.
     if (!AddrPool.isEmpty() &&
-        (getDwarfVersion() >= 5 ||
-         (SkCU && !TheCU.getUnitDie().children().empty())))
+        (getDwarfVersion() >= 5 || HasSplitUnit))
       U.addAddrTableBase();
 
     if (getDwarfVersion() >= 5) {


        


More information about the llvm-commits mailing list