Skip to content

Commit af63e86

Browse files
committed
Address review comments
1 parent e246794 commit af63e86

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,10 @@ DebugHandlerBase::DebugHandlerBase(AsmPrinter *A) : Asm(A), MMI(Asm->MMI) {}
103103
DebugHandlerBase::~DebugHandlerBase() = default;
104104

105105
void DebugHandlerBase::beginModule(Module *M) {
106-
if (M->debug_compile_units().empty()) {
106+
if (M->debug_compile_units().empty())
107107
Asm = nullptr;
108-
return;
109-
}
110-
111-
LScopes.initialize(*M);
108+
else
109+
LScopes.initialize(*M);
112110
}
113111

114112
// Each LexicalScope has first instruction and last instruction to mark

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,17 +1251,15 @@ void DwarfCompileUnit::constructAbstractSubprogramScopeDIE(
12511251
LexicalScope *Scope) {
12521252
auto *SP = cast<DISubprogram>(Scope->getScopeNode());
12531253

1254-
if (getFinalizedAbstractSubprograms().contains(SP)) {
1254+
// Populate subprogram DIE only once.
1255+
if (!getFinalizedAbstractSubprograms().insert(SP).second)
12551256
return;
1256-
}
12571257

12581258
auto [ContextDIE, ContextCU] = getOrCreateAbstractSubprogramContextDIE(SP);
12591259
DIE *AbsDef = getAbstractScopeDIEs().lookup(SP);
12601260
if (!AbsDef)
12611261
AbsDef = &createAbstractSubprogramDIE(SP, ContextDIE, ContextCU);
12621262

1263-
getFinalizedAbstractSubprograms().insert(SP);
1264-
12651263
if (DIE *ObjectPointer = ContextCU->createAndAddScopeChildren(Scope, *AbsDef))
12661264
ContextCU->addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer,
12671265
*ObjectPointer);

llvm/lib/CodeGen/AsmPrinter/DwarfFile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class DwarfFile {
9696
// Collection of abstract subprogram DIEs.
9797
DenseMap<const DILocalScope *, DIE *> AbstractLocalScopeDIEs;
9898
DenseMap<const DINode *, std::unique_ptr<DbgEntity>> AbstractEntities;
99+
/// Keeps track of abstract subprograms to populate them only once.
99100
// FIXME: merge creation and population of abstract scopes.
100101
SmallPtrSet<const DISubprogram *, 8> FinalizedAbstractSubprograms;
101102

0 commit comments

Comments
 (0)