Skip to content

Commit 560ab1f

Browse files
committed
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)
1 parent 9b9327f commit 560ab1f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,10 @@ void DwarfDebug::finalizeModuleInfo() {
11041104
// If we're splitting the dwarf out now that we've got the entire
11051105
// CU then add the dwo id to it.
11061106
auto *SkCU = TheCU.getSkeleton();
1107-
if (useSplitDwarf() && !TheCU.getUnitDie().children().empty()) {
1107+
1108+
bool HasSplitUnit = SkCU && !TheCU.getUnitDie().children().empty();
1109+
1110+
if (HasSplitUnit) {
11081111
finishUnitAttributes(TheCU.getCUNode(), TheCU);
11091112
TheCU.addString(TheCU.getUnitDie(), dwarf::DW_AT_GNU_dwo_name,
11101113
Asm->TM.Options.MCOptions.SplitDwarfFile);
@@ -1155,8 +1158,7 @@ void DwarfDebug::finalizeModuleInfo() {
11551158
// We don't keep track of which addresses are used in which CU so this
11561159
// is a bit pessimistic under LTO.
11571160
if (!AddrPool.isEmpty() &&
1158-
(getDwarfVersion() >= 5 ||
1159-
(SkCU && !TheCU.getUnitDie().children().empty())))
1161+
(getDwarfVersion() >= 5 || HasSplitUnit))
11601162
U.addAddrTableBase();
11611163

11621164
if (getDwarfVersion() >= 5) {

0 commit comments

Comments
 (0)