[llvm] r193196 - Debug Info: code clean up.

Manman Ren manman.ren at gmail.com
Tue Oct 22 15:16:42 PDT 2013


This is not really related to how abstract scope works. I was browsing
through the code and tried to figure out the usage of DeadFunScopeMap.
I noticed that the created lexical scope "Scope" is only used in
SPCU->constructVariableDIE(&NewVar, Scope->isAbstractScope())
and Scope->isAbstractScope() should be false from the creation, so we can
replace it with false. Once that is done, Scope is not used any where,
so we can remove it and then remove the DeadFnScopeMap.

Manman


On Tue, Oct 22, 2013 at 2:09 PM, Eric Christopher <echristo at gmail.com>wrote:

> Ur? Could you elaborate more here on the abstract scope thing?
>
> -eric
>
> On Tue, Oct 22, 2013 at 1:59 PM, Manman Ren <manman.ren at gmail.com> wrote:
> > Author: mren
> > Date: Tue Oct 22 15:59:19 2013
> > New Revision: 193196
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=193196&view=rev
> > Log:
> > Debug Info: code clean up.
> >
> > Remove unnecessary creation of LexicalScope in collectDeadVariables.
> > The created LexicialScope was only used to get isAbstractScope, which
> > should be false from the creation:
> > "new LexicalScope(NULL, DIDescriptor(SP), NULL, false);".
> >
> > We can also remove a DenseMap that holds the created LexicalScopes.
> >
> > Modified:
> >     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=193196&r1=193195&r2=193196&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Oct 22 15:59:19
> 2013
> > @@ -969,7 +969,6 @@ void DwarfDebug::computeInlinedDIEs() {
> >  // Collect info for variables that were optimized out.
> >  void DwarfDebug::collectDeadVariables() {
> >    const Module *M = MMI->getModule();
> > -  DenseMap<const MDNode *, LexicalScope *> DeadFnScopeMap;
> >
> >    if (NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu")) {
> >      for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
> > @@ -987,10 +986,6 @@ void DwarfDebug::collectDeadVariables()
> >          if (Variables.getNumElements() == 0)
> >            continue;
> >
> > -        LexicalScope *Scope =
> > -            new LexicalScope(NULL, DIDescriptor(SP), NULL, false);
> > -        DeadFnScopeMap[SP] = Scope;
> > -
> >          // Construct subprogram DIE and add variables DIEs.
> >          CompileUnit *SPCU = CUMap.lookup(TheCU);
> >          assert(SPCU && "Unable to find Compile Unit!");
> > @@ -1004,13 +999,12 @@ void DwarfDebug::collectDeadVariables()
> >              continue;
> >            DbgVariable NewVar(DV, NULL, this);
> >            if (DIE *VariableDIE =
> > -                  SPCU->constructVariableDIE(&NewVar,
> Scope->isAbstractScope()))
> > +                  SPCU->constructVariableDIE(&NewVar, false))
> >              SPDIE->addChild(VariableDIE);
> >          }
> >        }
> >      }
> >    }
> > -  DeleteContainerSeconds(DeadFnScopeMap);
> >  }
> >
> >  // Type Signature [7.27] and ODR Hash code.
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131022/a60b065f/attachment.html>


More information about the llvm-commits mailing list