diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-05-12 18:23:35 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-05-12 18:23:35 +0000 |
commit | 9f84cecfdc7c3f129cbd55c98c02c22edd2ea143 (patch) | |
tree | 1f4531197df52a73fb59a476191a36b509798459 /lib/CodeGen/AsmPrinter | |
parent | d6cd0381f676a6eb27d8b3b2aed70eed5fcb439d (diff) | |
download | llvm-9f84cecfdc7c3f129cbd55c98c02c22edd2ea143.tar.gz llvm-9f84cecfdc7c3f129cbd55c98c02c22edd2ea143.tar.bz2 llvm-9f84cecfdc7c3f129cbd55c98c02c22edd2ea143.tar.xz |
DwarfDebug: Avoid an extra map lookup while constructing abstract scope DIEs and reduce nesting/conditionals.
One test case had to be updated as it still had the extra indirection
for the variable list - removing the extra indirection got it back to
passing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 57d46541dd..5f0f208e87 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -576,7 +576,8 @@ void DwarfDebug::constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU, DISubprogram Sub(Scope->getScopeNode()); - ProcessedSPNodes.insert(Sub); + if (!ProcessedSPNodes.insert(Sub)) + return; if (DIE *ScopeDIE = TheCU.getDIE(Sub)) { AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE)); @@ -1575,25 +1576,25 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { // Construct abstract scopes. for (LexicalScope *AScope : LScopes.getAbstractScopesList()) { DISubprogram SP(AScope->getScopeNode()); - if (SP.isSubprogram()) { - // Collect info for variables that were optimized out. - DIArray Variables = SP.getVariables(); - for (unsigned i = 0, e = Variables.getNumElements(); i != e; ++i) { - DIVariable DV(Variables.getElement(i)); - if (!DV || !DV.isVariable() || !ProcessedVars.insert(DV)) - continue; - // Check that DbgVariable for DV wasn't created earlier, when - // findAbstractVariable() was called for inlined instance of DV. - LLVMContext &Ctx = DV->getContext(); - DIVariable CleanDV = cleanseInlinedVariable(DV, Ctx); - if (AbstractVariables.lookup(CleanDV)) - continue; - if (LexicalScope *Scope = LScopes.findAbstractScope(DV.getContext())) - addScopeVariable(Scope, new DbgVariable(DV, nullptr, this)); - } + if (!SP.isSubprogram()) + continue; + // Collect info for variables that were optimized out. + DIArray Variables = SP.getVariables(); + for (unsigned i = 0, e = Variables.getNumElements(); i != e; ++i) { + DIVariable DV(Variables.getElement(i)); + assert(DV && DV.isVariable()); + if (!ProcessedVars.insert(DV)) + continue; + // Check that DbgVariable for DV wasn't created earlier, when + // findAbstractVariable() was called for inlined instance of DV. + LLVMContext &Ctx = DV->getContext(); + DIVariable CleanDV = cleanseInlinedVariable(DV, Ctx); + if (AbstractVariables.lookup(CleanDV)) + continue; + if (LexicalScope *Scope = LScopes.findAbstractScope(DV.getContext())) + addScopeVariable(Scope, new DbgVariable(DV, nullptr, this)); } - if (ProcessedSPNodes.count(AScope->getScopeNode()) == 0) - constructAbstractSubprogramScopeDIE(TheCU, AScope); + constructAbstractSubprogramScopeDIE(TheCU, AScope); } DIE &CurFnDIE = constructSubprogramScopeDIE(TheCU, FnScope); |