Skip to content

Commit

Permalink
DebugInfo: Pull out a common expression.
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
dwblaikie committed Dec 6, 2019
1 parent 9b9327f commit 560ab1f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 560ab1f

Please sign in to comment.