[llvm] r263424 - Recommitted r261633 "Supporting all entities declared in lexical scope in LLVM debug info."

Aboud, Amjad via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 13:27:35 PDT 2016


Alright you may revert.
Can you open a bug for this error so I can take a look on it?

Thanks,
Amjad

> -----Original Message-----
> From: Benjamin Kramer [mailto:benny.kra at gmail.com]
> Sent: Monday, March 14, 2016 17:05
> To: Aboud, Amjad <amjad.aboud at intel.com>
> Cc: Chandler Carruth via llvm-commits <llvm-commits at lists.llvm.org>
> Subject: Re: [llvm] r263424 - Recommitted r261633 "Supporting all entities
> declared in lexical scope in LLVM debug info."
> 
> On Mon, Mar 14, 2016 at 1:03 PM, Amjad Aboud via llvm-commits <llvm-
> commits at lists.llvm.org> wrote:
> > Author: aaboud
> > Date: Mon Mar 14 07:03:20 2016
> > New Revision: 263424
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=263424&view=rev
> > Log:
> > Recommitted r261633 "Supporting all entities declared in lexical scope in
> LLVM debug info."
> > After fixing PR26715 at r263379.
> 
> I had to revert this (and r263424) as it breaks self-hosting LLVM (with debug
> info).
> 
> See
> http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_build/1753/
> http://lab.llvm.org:8080/green/job/llvm-stage2-cmake-RgLTO_build/5399/
> 
> >
> > Added:
> >     llvm/trunk/test/DebugInfo/X86/PR24008.ll
> >       - copied unchanged from r261670,
> llvm/trunk/test/DebugInfo/X86/PR24008.ll
> >     llvm/trunk/test/DebugInfo/X86/lexical-block-inline.ll
> >       - copied unchanged from r261670,
> llvm/trunk/test/DebugInfo/X86/lexical-block-inline.ll
> >     llvm/trunk/test/DebugInfo/X86/lexical-block.ll
> >       - copied unchanged from r261670,
> llvm/trunk/test/DebugInfo/X86/lexical-block.ll
> >     llvm/trunk/test/DebugInfo/X86/subprogram-inline.ll
> >       - copied unchanged from r261670,
> > llvm/trunk/test/DebugInfo/X86/subprogram-inline.ll
> > Modified:
> >     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> >     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
> >     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> >     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> >     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> >     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
> >     llvm/trunk/test/DebugInfo/Generic/2010-04-06-NestedFnDbgInfo.ll
> >     llvm/trunk/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
> >     llvm/trunk/test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
> >     llvm/trunk/test/DebugInfo/Generic/namespace.ll
> >     llvm/trunk/test/DebugInfo/Generic/nodebug.ll
> >     llvm/trunk/test/DebugInfo/Mips/InlinedFnLocalVar.ll
> >     llvm/trunk/test/DebugInfo/X86/InlinedFnLocalVar.ll
> >     llvm/trunk/test/DebugInfo/X86/dbg-file-name.ll
> >     llvm/trunk/test/DebugInfo/X86/debug-dead-local-var.ll
> >     llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/
> > DwarfCompileUnit.cpp?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Mar
> 14
> > +++ 07:03:20 2016
> > @@ -114,10 +114,16 @@ DIE *DwarfCompileUnit::getOrCreateGlobal
> >
> >    // Construct the context before querying for the existence of the DIE in
> >    // case such construction creates the DIE.
> > -  DIE *ContextDIE = getOrCreateContextDIE(GVContext);
> > +  // For Local Scope, do not construct context DIE.
> > +  bool IsLocalScope = GVContext && isa<DILocalScope>(GVContext);  DIE
> > + *ContextDIE = IsLocalScope ? nullptr :
> > + getOrCreateContextDIE(GVContext);  assert(ContextDIE ||
> > + IsLocalScope);
> > +
> > +  // Create new global variable and add to map.
> > +  DIE *VariableDIE = IsLocalScope
> > +                         ? createDIE(GV->getTag(), GV)
> > +                         : &createAndAddDIE(GV->getTag(),
> > + *ContextDIE, GV);
> >
> > -  // Add to map.
> > -  DIE *VariableDIE = &createAndAddDIE(GV->getTag(), *ContextDIE, GV);
> >    DIScope *DeclContext;
> >    if (auto *SDMDecl = GV->getStaticDataMemberDeclaration()) {
> >      DeclContext = resolve(SDMDecl->getScope()); @@ -335,23 +341,15 @@
> > void DwarfCompileUnit::constructScopeDIE
> >      if (DD->isLexicalScopeDIENull(Scope))
> >        return;
> >
> > -    unsigned ChildScopeCount;
> > +    bool HasNonScopeChildren;
> >
> >      // We create children here when we know the scope DIE is not going to
> be
> >      // null and the children will be added to the scope DIE.
> > -    createScopeChildrenDIE(Scope, Children, &ChildScopeCount);
> > -
> > -    // Skip imported directives in gmlt-like data.
> > -    if (!includeMinimalInlineScopes()) {
> > -      // There is no need to emit empty lexical block DIE.
> > -      for (const auto *IE : ImportedEntities[DS])
> > -        Children.push_back(
> > -            constructImportedEntityDIE(cast<DIImportedEntity>(IE)));
> > -    }
> > +    createScopeChildrenDIE(Scope, Children, &HasNonScopeChildren);
> >
> >      // If there are only other scopes as children, put them directly in the
> >      // parent instead, as this scope would serve no purpose.
> > -    if (Children.size() == ChildScopeCount) {
> > +    if (!HasNonScopeChildren) {
> >        FinalChildren.insert(FinalChildren.end(),
> >                             std::make_move_iterator(Children.begin()),
> >                             std::make_move_iterator(Children.end()));
> > @@ -366,6 +364,7 @@ void DwarfCompileUnit::constructScopeDIE
> >      ScopeDIE->addChild(std::move(I));
> >
> >    FinalChildren.push_back(std::move(ScopeDIE));
> > +  addLocalScopeDieToLexicalScope(Scope, ScopeDIE);
> >  }
> >
> >  DIE::value_iterator
> > @@ -558,20 +557,37 @@ DIE *DwarfCompileUnit::constructVariable
> >
> >  DIE *DwarfCompileUnit::createScopeChildrenDIE(LexicalScope *Scope,
> >                                                SmallVectorImpl<DIE *> &Children,
> > -                                              unsigned *ChildScopeCount) {
> > +                                              bool
> > + *HasNonScopeChildren) {
> >    DIE *ObjectPointer = nullptr;
> > +  bool HasLocalDclDie = false;
> > +  auto *DS = Scope->getScopeNode();
> >
> >    for (DbgVariable *DV : DU->getScopeVariables().lookup(Scope))
> >      Children.push_back(constructVariableDIE(*DV, *Scope,
> > ObjectPointer));
> >
> > -  unsigned ChildCountWithoutScopes = Children.size();
> > +  // Skip local declarations in gmlt-like data.
> > +  if (!includeMinimalInlineScopes()) {
> > +    for (const auto *DI : LocalDeclNodes[DS]) {
> > +      DIE *D = nullptr;
> > +      if (auto *IE = dyn_cast<DIImportedEntity>(DI))
> > +        D = getOrCreateImportedEntityDIE(IE);
> > +      else if (auto *GV = dyn_cast<DIGlobalVariable>(DI))
> > +        D = getOrCreateGlobalVariableDIE(GV);
> > +      else if (auto *RT = dyn_cast<DIType>(DI))
> > +        D = getOrCreateTypeDIE(RT);
> > +      else
> > +        llvm_unreachable("Unexpected DI node!");
> > +      addLocalDclDieToLexicalScope(Scope, D);
> > +      HasLocalDclDie = true;
> > +    }
> > +  }
> > +
> > +  if (HasNonScopeChildren)
> > +    *HasNonScopeChildren = !Children.empty() || HasLocalDclDie;
> >
> >    for (LexicalScope *LS : Scope->getChildren())
> >      constructScopeDIE(LS, Children);
> >
> > -  if (ChildScopeCount)
> > -    *ChildScopeCount = Children.size() - ChildCountWithoutScopes;
> > -
> >    return ObjectPointer;
> >  }
> >
> > @@ -613,6 +629,8 @@ DIE *DwarfCompileUnit::createAndAddScope
> >    for (auto &I : Children)
> >      ScopeDIE.addChild(std::move(I));
> >
> > +  addLocalScopeDieToLexicalScope(Scope, &ScopeDIE);
> > +
> >    return ObjectPointer;
> >  }
> >
> > @@ -649,10 +667,20 @@ void DwarfCompileUnit::constructAbstract
> >      addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer,
> > *ObjectPointer);  }
> >
> > +DIE *DwarfCompileUnit::getOrCreateImportedEntityDIE(
> > +    const DIImportedEntity *Module) {
> > +  if (DIE *Die = getDIE(Module))
> > +    return Die;
> > +
> > +  return constructImportedEntityDIE(Module);
> > +}
> > +
> >  DIE *DwarfCompileUnit::constructImportedEntityDIE(
> >      const DIImportedEntity *Module) {
> > -  DIE *IMDie = DIE::get(DIEValueAllocator,
> > (dwarf::Tag)Module->getTag());
> > -  insertDIE(Module, IMDie);
> > +
> > +  assert(!getDIE(Module));
> > +
> > +  DIE *IMDie = createDIE(Module->getTag(), Module);
> >    DIE *EntityDie;
> >    auto *Entity = resolve(Module->getEntity());
> >    if (auto *NS = dyn_cast<DINamespace>(Entity)) @@ -679,22 +707,46 @@
> > DIE *DwarfCompileUnit::constructImported
> >  }
> >
> >  void DwarfCompileUnit::finishSubprogramDefinition(const DISubprogram
> > *SP) {
> > -  DIE *D = getDIE(SP);
> > -  if (DIE *AbsSPDIE = DU->getAbstractSPDies().lookup(SP)) {
> > -    if (D)
> > +  if (DIE *D = getDIE(SP)) {
> > +    if (DIE *AbsSPDIE = DU->getAbstractSPDies().lookup(SP))
> >        // If this subprogram has an abstract definition, reference that
> >        addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
> > -  } else {
> > -    if (!D && !includeMinimalInlineScopes())
> > -      // Lazily construct the subprogram if we didn't see either concrete or
> > -      // inlined versions during codegen. (except in -gmlt ^ where we want
> > -      // to omit these entirely)
> > -      D = getOrCreateSubprogramDIE(SP);
> > -    if (D)
> > +    else
> >        // And attach the attributes
> >        applySubprogramAttributesToDefinition(SP, *D);
> >    }
> >  }
> > +
> > +void DwarfCompileUnit::finishLocalScopeDefinitions() {
> > +  for (const auto &I : getLSDieInfoMap()) {
> > +    auto LSInfo = I.second;
> > +    // Attach all local dcl DIEs to abstract local scope if available,
> > +    // otherwise attach it to concrete local scope.
> > +    DIE *LBDie =
> > +        LSInfo.AbstractLSDie ? LSInfo.AbstractLSDie : LSInfo.ConcreteLSDie;
> > +    assert(LBDie || LSInfo.LocalDclDies.empty());
> > +    for (auto &D : LSInfo.LocalDclDies)
> > +      LBDie->addChild(std::move(D));
> > +
> > +    if (isa<DISubprogram>(I.first))
> > +      // For function scope there is nothing else to do.
> > +      // "abstract_origin" dwarf attribute was added somewhere else.
> > +      continue;
> > +
> > +    if (LSInfo.AbstractLSDie) {
> > +      // Add "abstract_origin" dwarf attribute to concrete local scope
> pointing
> > +      // to the corresponding abstract local scope.
> > +      if (LSInfo.ConcreteLSDie)
> > +        addDIEEntry(*LSInfo.ConcreteLSDie, dwarf::DW_AT_abstract_origin,
> > +                    *LSInfo.AbstractLSDie);
> > +      // Add "abstract_origin" dwarf attribute to inline local scope pointing
> > +      // to the corresponding abstract local scope.
> > +      for (auto &L : LSInfo.InlineLSDies)
> > +        addDIEEntry(*L, dwarf::DW_AT_abstract_origin,
> *LSInfo.AbstractLSDie);
> > +    }
> > +  }
> > +}
> > +
> >  void DwarfCompileUnit::collectDeadVariables(const DISubprogram *SP) {
> >    assert(SP && "CU's subprogram list contains a non-subprogram");
> >    assert(SP->isDefinition() &&
> > @@ -705,7 +757,7 @@ void DwarfCompileUnit::collectDeadVariab
> >
> >    DIE *SPDIE = DU->getAbstractSPDies().lookup(SP);
> >    if (!SPDIE)
> > -    SPDIE = getDIE(SP);
> > +    return;
> >    assert(SPDIE);
> >    for (const DILocalVariable *DV : Variables) {
> >      DbgVariable NewVar(DV, /* IA */ nullptr, DD); @@ -830,6 +882,30
> > @@ void DwarfCompileUnit::applySubprogramAt
> >    addGlobalName(SP->getName(), SPDie, Context);  }
> >
> > +void DwarfCompileUnit::addLocalScopeDieToLexicalScope(LexicalScope
> *LS,
> > +                                                      DIE *D) {
> > +  auto &LSInfo = getLSDieInfoMap()[LS->getScopeNode()];
> > +  if (LS->isAbstractScope()) {
> > +    assert(!LSInfo.AbstractLSDie && "Adding abstract LS DIE twice.");
> > +    LSInfo.AbstractLSDie = D;
> > +    return;
> > +  }
> > +  if (LS->getInlinedAt()) {
> > +    assert(!LSInfo.InlineLSDies.count(D) && "Adding inline LS DIE twice.");
> > +    LSInfo.InlineLSDies.insert(D);
> > +    return;
> > +  }
> > +  assert(!LSInfo.ConcreteLSDie && "Adding cocncrete LS DIE twice.");
> > +  LSInfo.ConcreteLSDie = D;
> > +  return;
> > +}
> > +
> > +void DwarfCompileUnit::addLocalDclDieToLexicalScope(LexicalScope *LS,
> > +DIE *D) {
> > +  auto &LSInfo = getLSDieInfoMap()[LS->getScopeNode()];
> > +  LSInfo.LocalDclDies.insert(D);
> > +  return;
> > +}
> > +
> >  bool DwarfCompileUnit::isDwoUnit() const {
> >    return DD->useSplitDwarf() && Skeleton;  }
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/
> > DwarfCompileUnit.h?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Mon Mar 14
> > +++ 07:03:20 2016
> > @@ -15,6 +15,7 @@
> >  #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
> >
> >  #include "DwarfUnit.h"
> > +#include "llvm/ADT/SetVector.h"
> >  #include "llvm/ADT/StringRef.h"
> >  #include "llvm/IR/DebugInfo.h"
> >  #include "llvm/Support/Dwarf.h"
> > @@ -48,11 +49,10 @@ class DwarfCompileUnit : public DwarfUni
> >    /// The start of the unit macro info within macro section.
> >    MCSymbol *MacroLabelBegin;
> >
> > -  typedef llvm::SmallVector<const MDNode *, 8> ImportedEntityList;
> > -  typedef llvm::DenseMap<const MDNode *, ImportedEntityList>
> > -  ImportedEntityMap;
> > +  typedef llvm::SmallVector<const MDNode *, 8> LocalDeclNodeList;
> > + typedef llvm::DenseMap<const MDNode *, LocalDeclNodeList>
> > + LocalScopesMap;
> >
> > -  ImportedEntityMap ImportedEntities;
> > +  LocalScopesMap LocalDeclNodes;
> >
> >    /// GlobalNames - A map of globally visible named entities for this unit.
> >    StringMap<const DIE *> GlobalNames; @@ -71,6 +71,15 @@ class
> > DwarfCompileUnit : public DwarfUni
> >    // ranges/locs.
> >    const MCSymbol *BaseAddress;
> >
> > +  struct LocalScopeDieInfo {
> > +    DIE *ConcreteLSDie = nullptr;
> > +    DIE *AbstractLSDie = nullptr;
> > +    SetVector<DIE *> InlineLSDies;
> > +    SetVector<DIE *> LocalDclDies;
> > +  };
> > +  // Collection of local scope DIE info.
> > +  DenseMap<const MDNode *, LocalScopeDieInfo>
> LocalScopeDieInfoMap;
> > +
> >    /// \brief Construct a DIE for the given DbgVariable without initializing the
> >    /// DbgVariable's DIE reference.
> >    DIE *constructVariableDIEImpl(const DbgVariable &DV, bool
> > Abstract); @@ -117,8 +126,8 @@ public:
> >
> >    unsigned getOrCreateSourceID(StringRef FileName, StringRef DirName)
> > override;
> >
> > -  void addImportedEntity(const DIImportedEntity* IE) {
> > -    ImportedEntities[IE->getScope()].push_back(IE);
> > +  void addLocalDeclNode(const DINode *DI, DILocalScope *Scope) {
> > +    LocalDeclNodes[Scope].push_back(DI);
> >    }
> >
> >    /// addRange - Add an address range to the list of ranges for this unit.
> > @@ -166,7 +175,7 @@ public:
> >    /// A helper function to create children of a Scope DIE.
> >    DIE *createScopeChildrenDIE(LexicalScope *Scope,
> >                                SmallVectorImpl<DIE *> &Children,
> > -                              unsigned *ChildScopeCount = nullptr);
> > +                              bool *HasNonScopeChildren = nullptr);
> >
> >    /// \brief Construct a DIE for this subprogram scope.
> >    void constructSubprogramScopeDIE(LexicalScope *Scope); @@ -175,11
> > +184,15 @@ public:
> >
> >    void constructAbstractSubprogramScopeDIE(LexicalScope *Scope);
> >
> > +  /// \brief Get or create import_module DIE.
> > +  DIE *getOrCreateImportedEntityDIE(const DIImportedEntity *Module);
> >    /// \brief Construct import_module DIE.
> >    DIE *constructImportedEntityDIE(const DIImportedEntity *Module);
> >
> >    void finishSubprogramDefinition(const DISubprogram *SP);
> >
> > +  void finishLocalScopeDefinitions();
> > +
> >    void collectDeadVariables(const DISubprogram *SP);
> >
> >    /// Set the skeleton unit associated with this unit.
> > @@ -253,6 +266,15 @@ public:
> >
> >    void setBaseAddress(const MCSymbol *Base) { BaseAddress = Base; }
> >    const MCSymbol *getBaseAddress() const { return BaseAddress; }
> > +
> > +  DenseMap<const MDNode *, LocalScopeDieInfo> &getLSDieInfoMap() {
> > +    return LocalScopeDieInfoMap;
> > +  }
> > +
> > +  /// Add local scope DIE entry to lexical scope info.
> > +  void addLocalScopeDieToLexicalScope(LexicalScope *LS, DIE *D);  ///
> > + Add local declaration DIE entry to lexical scope info.
> > +  void addLocalDclDieToLexicalScope(LexicalScope *LS, DIE *D);
> >  };
> >
> >  } // end llvm namespace
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/
> > DwarfDebug.cpp?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Mar 14
> > +++ 07:03:20 2016
> > @@ -455,6 +455,16 @@ void DwarfDebug::constructAndAddImported
> >      D->addChild(TheCU.constructImportedEntityDIE(N));
> >  }
> >
> > +bool DwarfDebug::collectLocalScopedNode(DIScope *S, const DINode *N,
> > +                                        DwarfCompileUnit &CU) {
> > +  if (auto LS = dyn_cast_or_null<DILocalScope>(S)) {
> > +    getLocalScopes(LS->getSubprogram()).insert(LS);
> > +    CU.addLocalDeclNode(N, LS);
> > +    return true;
> > +  }
> > +  return false;
> > +}
> > +
> >  // Emit all Dwarf sections that should come prior to the content.
> > Create  // global DIEs and emit initial debug info sections. This is
> > invoked by  // the target AsmPrinter.
> > @@ -474,10 +484,9 @@ void DwarfDebug::beginModule() {
> >    for (MDNode *N : CU_Nodes->operands()) {
> >      auto *CUNode = cast<DICompileUnit>(N);
> >      DwarfCompileUnit &CU = constructDwarfCompileUnit(CUNode);
> > -    for (auto *IE : CUNode->getImportedEntities())
> > -      CU.addImportedEntity(IE);
> >      for (auto *GV : CUNode->getGlobalVariables())
> > -      CU.getOrCreateGlobalVariableDIE(GV);
> > +      if (!collectLocalScopedNode(GV->getScope(), GV, CU))
> > +        CU.getOrCreateGlobalVariableDIE(GV);
> >      for (auto *SP : CUNode->getSubprograms())
> >        SPMap.insert(std::make_pair(SP, &CU));
> >      for (auto *Ty : CUNode->getEnumTypes()) { @@ -489,14 +498,17 @@
> > void DwarfDebug::beginModule() {
> >        // The retained types array by design contains pointers to
> >        // MDNodes rather than DIRefs. Unique them here.
> >        DIType *RT = cast<DIType>(resolve(Ty->getRef()));
> > -      if (!RT->isExternalTypeRef())
> > +      if (RT->isExternalTypeRef())
> >          // There is no point in force-emitting a forward declaration.
> > +        continue;
> > +      if (!collectLocalScopedNode(resolve(Ty->getScope()), RT, CU))
> >          CU.getOrCreateTypeDIE(RT);
> >      }
> >      // Emit imported_modules last so that the relevant context is already
> >      // available.
> >      for (auto *IE : CUNode->getImportedEntities())
> > -      constructAndAddImportedEntityDIE(CU, IE);
> > +      if (!collectLocalScopedNode(IE->getScope(), IE, CU))
> > +        constructAndAddImportedEntityDIE(CU, IE);
> >    }
> >
> >    // Tell MMI that we have debug info.
> > @@ -529,6 +541,11 @@ void DwarfDebug::finishSubprogramDefinit
> >      });
> >  }
> >
> > +void DwarfDebug::finishLocalScopeDefinitions() {
> > +  for (const auto &I : CUMap)
> > +    I.second->finishLocalScopeDefinitions();
> > +}
> > +
> >  // Collect info for variables that were optimized out.
> >  void DwarfDebug::collectDeadVariables() {
> >    const Module *M = MMI->getModule(); @@ -554,6 +571,8 @@ void
> > DwarfDebug::finalizeModuleInfo() {
> >
> >    finishSubprogramDefinitions();
> >
> > +  finishLocalScopeDefinitions();
> > +
> >    finishVariableDefinitions();
> >
> >    // Collect info for variables that were optimized out.
> > @@ -1164,6 +1183,9 @@ void DwarfDebug::endFunction(const Machi
> >        assert(LScopes.getAbstractScopesList().size() == NumAbstractScopes
> >               && "ensureAbstractVariableIsCreated inserted abstract scopes");
> >      }
> > +    // Assure abstract local scope created for each one contains local DIEs.
> > +    for (const DILocalScope *LS : getLocalScopes(SP))
> > +      LScopes.getOrCreateAbstractScope(LS);
> >      constructAbstractSubprogramScopeDIE(AScope);
> >    }
> >
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/
> > DwarfDebug.h?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Mar 14
> 07:03:20
> > +++ 2016
> > @@ -211,6 +211,10 @@ class DwarfDebug : public DebugHandlerBa
> >    /// Size of each symbol emitted (for those symbols that have a specific
> size).
> >    DenseMap<const MCSymbol *, uint64_t> SymSize;
> >
> > +  /// Holder for scopes containing local declaration DI nodes per DI
> function.
> > +  DenseMap<const DISubprogram *, SmallPtrSet<const DILocalScope *,
> 16>>
> > +      LocalScopesMap;
> > +
> >    /// Collection of abstract variables.
> >    DenseMap<const MDNode *, std::unique_ptr<DbgVariable>>
> AbstractVariables;
> >    SmallVector<std::unique_ptr<DbgVariable>, 64> ConcreteVariables; @@
> > -327,6 +331,8 @@ class DwarfDebug : public DebugHandlerBa
> >
> >    void finishSubprogramDefinitions();
> >
> > +  void finishLocalScopeDefinitions();
> > +
> >    /// Finish off debug information after all functions have been
> >    /// processed.
> >    void finalizeModuleInfo();
> > @@ -425,6 +431,11 @@ class DwarfDebug : public DebugHandlerBa
> >    void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
> >                                          const DIImportedEntity *N);
> >
> > +  /// Collect MD Node located within local scope node.
> > +  /// Return true if node was collected, false otherwise.
> > +  bool collectLocalScopedNode(DIScope *S, const DINode *N,
> > +                              DwarfCompileUnit &CU);
> > +
> >    /// Register a source line with debug info. Returns the unique
> >    /// label that was emitted and which provides correspondence to the
> >    /// source line list.
> > @@ -567,6 +578,12 @@ public:
> >    SmallPtrSet<const MDNode *, 16> &getProcessedSPNodes() {
> >      return ProcessedSPNodes;
> >    }
> > +
> > +  /// Return collection of function scopes that contains local declararion
> DIEs.
> > +  SmallPtrSet<const DILocalScope *, 16> &  getLocalScopes(const
> > + DISubprogram *SP) {
> > +    return LocalScopesMap[SP];
> > +  }
> >  };
> >  } // End of namespace llvm
> >
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/
> > DwarfUnit.cpp?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Mon Mar 14
> > +++ 07:03:20 2016
> > @@ -298,10 +298,15 @@ void DwarfUnit::addDIEEntry(DIE &Die, dw
> >                 Entry);
> >  }
> >
> > -DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const
> > DINode *N) {
> > -  DIE &Die = Parent.addChild(DIE::get(DIEValueAllocator,
> > (dwarf::Tag)Tag));
> > +DIE *DwarfUnit::createDIE(unsigned Tag, const DINode *N) {
> > +  DIE *Die = DIE::get(DIEValueAllocator, (dwarf::Tag)Tag);
> >    if (N)
> > -    insertDIE(N, &Die);
> > +    insertDIE(N, Die);
> > +  return Die;
> > +}
> > +
> > +DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const
> > +DINode *N) {
> > +  DIE &Die = Parent.addChild(createDIE(Tag, N));
> >    return Die;
> >  }
> >
> > @@ -727,15 +732,18 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const
> >
> >    // Construct the context before querying for the existence of the DIE in
> case
> >    // such construction creates the DIE.
> > +  // For Local Scope, do not construct context DIE.
> >    auto *Context = resolve(Ty->getScope());
> > -  DIE *ContextDIE = getOrCreateContextDIE(Context);
> > -  assert(ContextDIE);
> > +  bool IsLocalScope = Context && isa<DILocalScope>(Context);  DIE
> > + *ContextDIE = IsLocalScope ? nullptr :
> > + getOrCreateContextDIE(Context);  assert(ContextDIE || IsLocalScope);
> >
> >    if (DIE *TyDIE = getDIE(Ty))
> >      return TyDIE;
> >
> > -  // Create new type.
> > -  DIE &TyDIE = createAndAddDIE(Ty->getTag(), *ContextDIE, Ty);
> > +  // Create new type and add to map.
> > +  DIE &TyDIE = IsLocalScope ? *createDIE(Ty->getTag(), Ty)
> > +                            : createAndAddDIE(Ty->getTag(),
> > + *ContextDIE, Ty);
> >
> >    updateAcceleratorTables(Context, Ty, TyDIE);
> >
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/
> > DwarfUnit.h?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Mon Mar 14
> 07:03:20
> > +++ 2016
> > @@ -298,6 +298,9 @@ public:
> >    /// Construct function argument DIEs.
> >    void constructSubprogramArguments(DIE &Buffer, DITypeRefArray
> > Args);
> >
> > +  /// Create a DIE with the given Tag, and call insertDIE if MD is not null.
> > +  DIE *createDIE(unsigned Tag, const DINode *N = nullptr);
> > +
> >    /// Create a DIE with the given Tag, add the DIE to its parent, and
> >    /// call insertDIE if MD is not null.
> >    DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N =
> > nullptr);
> >
> > Modified:
> > llvm/trunk/test/DebugInfo/Generic/2010-04-06-NestedFnDbgInfo.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/
> > 2010-04-06-
> NestedFnDbgInfo.ll?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/Generic/2010-04-06-NestedFnDbgInfo.ll
> > (original)
> > +++ llvm/trunk/test/DebugInfo/Generic/2010-04-06-NestedFnDbgInfo.ll
> > +++ Mon Mar 14 07:03:20 2016
> > @@ -74,7 +74,7 @@ entry:
> >  !1 = distinct !DILexicalBlock(line: 15, column: 12, file: !38, scope:
> > !2)
> >  !2 = distinct !DISubprogram(name: "main", linkageName: "main", line:
> > 15, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized:
> > false, scopeLine: 15, file: !38, scope: !3, type: !5)
> >  !3 = !DIFile(filename: "one.cc", directory: "/tmp")
> > -!4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer:
> > "clang 1.5", isOptimized: false, emissionKind: 0, file: !38, enums:
> > !39, retainedTypes: !39, subprograms: !37, imports:  null)
> > +!4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer:
> > +"clang 1.5", isOptimized: false, emissionKind: 0, file: !38, enums:
> > +!39, retainedTypes: !41, subprograms: !37, imports:  null)
> >  !5 = !DISubroutineType(types: !6)
> >  !6 = !{!7}
> >  !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32,
> > align: 32, encoding: DW_ATE_signed) @@ -112,3 +112,4 @@ entry:
> >  !38 = !DIFile(filename: "one.cc", directory: "/tmp")
> >  !39 = !{}
> >  !40 = !{i32 1, !"Debug Info Version", i32 3}
> > +!41 = !{!21}
> > \ No newline at end of file
> >
> > Modified:
> > llvm/trunk/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/
> > 2010-06-29-
> InlinedFnLocalVar.ll?rev=263424&r1=263423&r2=263424&view=di
> > ff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
> > (original)
> > +++ llvm/trunk/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
> > +++ Mon Mar 14 07:03:20 2016
> > @@ -27,7 +27,7 @@ entry:
> >
> >  !0 = distinct !DISubprogram(name: "foo", line: 9, isLocal: true,
> > isDefinition: true, virtualIndex: 6, isOptimized: true, scopeLine: 9,
> > file: !27, scope: !1, type: !3, variables: !24)
> >  !1 = !DIFile(filename: "bar.c", directory: "/tmp/")
> > -!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1
> > (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true,
> > emissionKind: 0, file: !27, enums: !20, retainedTypes: !20,
> > subprograms: !25, globals: !26, imports:  !20)
> > +!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1
> > +(Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true,
> > +emissionKind: 0, file: !27, enums: !20, retainedTypes: !61,
> > +subprograms: !25, globals: !26, imports:  !20)
> >  !3 = !DISubroutineType(types: !4)
> >  !4 = !{!5, !5}
> >  !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32,
> > align: 32, encoding: DW_ATE_signed) @@ -39,6 +39,7 @@ entry:
> >
> >  !59 = !DILocalVariable(name: "j", line: 9, arg: 1, scope: !0, file:
> > !1, type: !5)
> >  !60 = !DILocalVariable(name: "xyz", line: 10, scope: !11, file: !1,
> > type: !12)
> > +!61 = !{!12}
> >
> >  !11 = distinct !DILexicalBlock(line: 9, column: 0, file: !1, scope:
> > !0)
> >  !12 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", line:
> > 10, size: 64, align: 32, file: !27, scope: !0, elements: !13)
> >
> > Modified:
> > llvm/trunk/test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/
> > cross-cu-linkonce-distinct.ll?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
> > (original)
> > +++ llvm/trunk/test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
> > +++ Mon Mar 14 07:03:20 2016
> > @@ -32,7 +32,7 @@
> >  ; CHECK:     DW_AT_name {{.*}} "func"
> >  ; CHECK: DW_TAG_compile_unit
> >
> > -; FIXME: Maybe we should drop the subprogram here - since the
> > function was
> > +; Check that the subprogram is dropped in this CU - since the
> > +function was
> >  ; emitted in one CU, due to linkonce_odr uniquing. We certainly don't
> > emit the  ; subprogram here if the source location for this definition
> > is the same (see  ; test/DebugInfo/cross-cu-linkonce.ll), though it's
> > very easy to tickle that @@ -43,7 +43,7 @@  ; directory of the source
> > file even though the file name is absolute, not  ; relative)
> >
> > -; CHECK: DW_TAG_subprogram
> > +; CHECK-NOT: DW_TAG_subprogram
> >
> >  @x = global i32 (i32)* @_Z4funci, align 8  @y = global i32 (i32)*
> > @_Z4funci, align 8 @@ -64,7 +64,7 @@ declare void
> > @llvm.dbg.declare(metadata,  attributes #0 = { inlinehint nounwind
> > uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true"
> > "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false"
> > "no-nans-fp-math"="false" "stack-protector-buffer-size"="8"
> > "unsafe-fp-math"="false" "use-soft-float"="false" }  attributes #1 = {
> > nounwind readnone }
> >
> > -!llvm.dbg.cu = !{!12, !0}
> > +!llvm.dbg.cu = !{!0, !12}
> >  !llvm.module.flags = !{!19, !20}
> >  !llvm.ident = !{!21, !21}
> >
> >
> > Modified: llvm/trunk/test/DebugInfo/Generic/namespace.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/
> > namespace.ll?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/Generic/namespace.ll (original)
> > +++ llvm/trunk/test/DebugInfo/Generic/namespace.ll Mon Mar 14
> 07:03:20
> > +++ 2016
> > @@ -23,6 +23,11 @@
> >  ; CHECK-NOT: NULL
> >  ; CHECK: [[BAR:0x[0-9a-f]*]]:{{ *}}DW_TAG_structure_type  ;
> > CHECK-NEXT: DW_AT_name{{.*}}= "bar"
> > +; CHECK: DW_TAG_subprogram
> > +; CHECK-NOT: DW_TAG
> > +; CHECK: DW_AT_MIPS_linkage_name
> > +; CHECK-NOT: DW_TAG
> > +; CHECK: DW_AT_name{{.*}}= "f1"
> >  ; CHECK: [[FUNC1:.*]]: DW_TAG_subprogram  ; CHECK-NOT: DW_TAG  ;
> > CHECK: DW_AT_MIPS_linkage_name @@ -45,11 +50,6 @@  ; CHECK-NOT:
> DW_TAG
> > ; CHECK: DW_AT_name{{.*}}= "func_fwd"
> >  ; CHECK-NOT: DW_AT_declaration
> > -; CHECK: DW_TAG_subprogram
> > -; CHECK-NOT: DW_TAG
> > -; CHECK: DW_AT_MIPS_linkage_name
> > -; CHECK-NOT: DW_TAG
> > -; CHECK: DW_AT_name{{.*}}= "f1"
> >  ; CHECK: NULL
> >
> >  ; CHECK-NOT: NULL
> > @@ -71,10 +71,23 @@
> >
> >  ; CHECK: DW_TAG_subprogram
> >  ; CHECK-NOT: DW_TAG
> > +; CHECK: DW_AT_name{{.*}}= "__cxx_global_var_init"
> > +; CHECK-NOT: DW_TAG
> > +
> > +; CHECK: DW_TAG_subprogram
> > +; CHECK-NOT: DW_TAG
> >  ; CHECK: DW_AT_MIPS_linkage_name
> >  ; CHECK-NOT: DW_TAG
> >  ; CHECK: DW_AT_name{{.*}}= "func"
> >  ; CHECK-NOT: NULL
> > +; CHECK: DW_TAG_lexical_block
> > +; CHECK-NOT: NULL
> > +; CHECK: DW_TAG_imported_module
> > +; CHECK-NEXT: DW_AT_decl_file{{.*}}([[F2]]) ; CHECK-NEXT:
> > +DW_AT_decl_line{{.*}}(23) ; CHECK-NEXT: DW_AT_import{{.*}}=> ;
> CHECK:
> > +NULL ; CHECK-NOT: NULL
> >  ; CHECK: DW_TAG_imported_module
> >  ; CHECK-NEXT: DW_AT_decl_file{{.*}}([[F2]])  ; CHECK-NEXT:
> > DW_AT_decl_line{{.*}}(26) @@ -134,13 +147,6 @@  ; CHECK-NEXT:
> > DW_AT_decl_line{{.*}}(37)  ; CHECK-NEXT: DW_AT_import{{.*}}=>
> > {[[FUNC_FWD]]})
> >
> > -; CHECK: DW_TAG_lexical_block
> > -; CHECK-NOT: NULL
> > -; CHECK: DW_TAG_imported_module
> > -; CHECK-NEXT: DW_AT_decl_file{{.*}}([[F2]]) -; CHECK-NEXT:
> > DW_AT_decl_line{{.*}}(23) -; CHECK-NEXT: DW_AT_import{{.*}}=> -;
> > CHECK: NULL  ; CHECK: NULL  ; CHECK: NULL
> >
> >
> > Modified: llvm/trunk/test/DebugInfo/Generic/nodebug.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/
> > nodebug.ll?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/Generic/nodebug.ll (original)
> > +++ llvm/trunk/test/DebugInfo/Generic/nodebug.ll Mon Mar 14 07:03:20
> > +++ 2016
> > @@ -16,10 +16,8 @@
> >  ;   f1();
> >  ; }
> >
> > -; Check that there's only one DW_TAG_subprogram, nothing for the 'f2'
> function.
> > -; CHECK: DW_TAG_subprogram
> > -; CHECK-NOT: DW_TAG
> > -; CHECK:   DW_AT_name {{.*}} "f1"
> > +; Check that there is no DW_TAG_subprogram, nothing for the 'f2'
> function.
> > +; Note: No debug info was emitted for 'f1' function because it has no
> code.
> >  ; CHECK-NOT: DW_TAG_subprogram
> >
> >  @i = external global i32
> >
> > Modified: llvm/trunk/test/DebugInfo/Mips/InlinedFnLocalVar.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Mips/Inl
> > inedFnLocalVar.ll?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/Mips/InlinedFnLocalVar.ll (original)
> > +++ llvm/trunk/test/DebugInfo/Mips/InlinedFnLocalVar.ll Mon Mar 14
> > +++ 07:03:20 2016
> > @@ -27,7 +27,7 @@ entry:
> >
> >  !0 = distinct !DISubprogram(name: "foo", line: 9, isLocal: true,
> > isDefinition: true, virtualIndex: 6, isOptimized: true, scopeLine: 9,
> > file: !27, scope: !1, type: !3, variables: !24)
> >  !1 = !DIFile(filename: "bar.c", directory: "/tmp/")
> > -!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1
> > (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true,
> > emissionKind: 0, file: !27, enums: !20, retainedTypes: !20,
> > subprograms: !25, globals: !26, imports:  !20)
> > +!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1
> > +(Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true,
> > +emissionKind: 0, file: !27, enums: !20, retainedTypes: !61,
> > +subprograms: !25, globals: !26, imports:  !20)
> >  !3 = !DISubroutineType(types: !4)
> >  !4 = !{!5, !5}
> >  !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32,
> > align: 32, encoding: DW_ATE_signed) @@ -39,6 +39,7 @@ entry:
> >
> >  !59 = !DILocalVariable(name: "j", line: 9, arg: 1, scope: !0, file:
> > !1, type: !5)
> >  !60 = !DILocalVariable(name: "xyz", line: 10, scope: !11, file: !1,
> > type: !12)
> > +!61 = !{!12}
> >
> >  !11 = distinct !DILexicalBlock(line: 9, column: 0, file: !1, scope:
> > !0)
> >  !12 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", line:
> > 10, size: 64, align: 32, file: !27, scope: !0, elements: !13)
> >
> > Modified: llvm/trunk/test/DebugInfo/X86/InlinedFnLocalVar.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/Inli
> > nedFnLocalVar.ll?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/X86/InlinedFnLocalVar.ll (original)
> > +++ llvm/trunk/test/DebugInfo/X86/InlinedFnLocalVar.ll Mon Mar 14
> > +++ 07:03:20 2016
> > @@ -27,7 +27,7 @@ entry:
> >
> >  !0 = distinct !DISubprogram(name: "foo", line: 9, isLocal: true,
> > isDefinition: true, virtualIndex: 6, isOptimized: true, scopeLine: 9,
> > file: !27, scope: !1, type: !3, variables: !24)
> >  !1 = !DIFile(filename: "bar.c", directory: "/tmp/")
> > -!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1
> > (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true,
> > emissionKind: 0, file: !27, enums: !20, retainedTypes: !20,
> > subprograms: !25, globals: !26, imports:  !20)
> > +!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1
> > +(Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true,
> > +emissionKind: 0, file: !27, enums: !20, retainedTypes: !111,
> > +subprograms: !25, globals: !26, imports:  !20)
> >  !3 = !DISubroutineType(types: !4)
> >  !4 = !{!5, !5}
> >  !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32,
> > align: 32, encoding: DW_ATE_signed) @@ -39,6 +39,7 @@ entry:
> >
> >  !109 = !DILocalVariable(name: "j", line: 9, arg: 1, scope: !0, file:
> > !1, type: !5)
> >  !110 = !DILocalVariable(name: "xyz", line: 10, scope: !11, file: !1,
> > type: !12)
> > +!111 = !{!12}
> >
> >  !11 = distinct !DILexicalBlock(line: 9, column: 0, file: !1, scope:
> > !0)
> >  !12 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", line:
> > 10, size: 64, align: 32, file: !27, scope: !0, elements: !13)
> >
> > Modified: llvm/trunk/test/DebugInfo/X86/dbg-file-name.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-
> > file-name.ll?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/X86/dbg-file-name.ll (original)
> > +++ llvm/trunk/test/DebugInfo/X86/dbg-file-name.ll Mon Mar 14 07:03:20
> > +++ 2016
> > @@ -6,7 +6,7 @@
> >  declare i32 @printf(i8*, ...) nounwind
> >
> >  define i32 @main() nounwind !dbg !6 {
> > -  ret i32 0
> > +  ret i32 0, !dbg !13
> >  }
> >
> >  !llvm.dbg.cu = !{!2}
> > @@ -22,3 +22,4 @@ define i32 @main() nounwind !dbg !6 {
> >  !10 = !DIFile(filename: "simple.c", directory:
> > "/Users/manav/one/two")
> >  !11 = !{}
> >  !12 = !{i32 1, !"Debug Info Version", i32 3}
> > +!13 = !DILocation(line: 10, scope: !6)
> >
> > Modified: llvm/trunk/test/DebugInfo/X86/debug-dead-local-var.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debu
> > g-dead-local-var.ll?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/X86/debug-dead-local-var.ll (original)
> > +++ llvm/trunk/test/DebugInfo/X86/debug-dead-local-var.ll Mon Mar 14
> > +++ 07:03:20 2016
> > @@ -11,9 +11,9 @@
> >  ;   return 1;
> >  ; }
> >
> > -; Check that we still have the structure type for X even though we're
> > not -; going to emit a low/high_pc for foo.
> > -; CHECK: DW_TAG_structure_type
> > +; Check that we will not have the structure type for X as we are
> > +going to omit ; the function foo.
> > +; CHECK-NOT: DW_TAG_structure_type
> >
> >  ; Function Attrs: nounwind readnone uwtable  define i32 @bar() #0
> > !dbg !4 { @@ -27,7 +27,7 @@ attributes #0 = { nounwind readnone uwta
> > !llvm.module.flags = !{!18, !19}  !llvm.ident = !{!20}
> >
> > -!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang
> > version 3.5.0 (trunk 209255) (llvm/trunk 209253)", isOptimized: true,
> > emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms:
> > !3, globals: !2, imports: !2)
> > +!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang
> > +version 3.5.0 (trunk 209255) (llvm/trunk 209253)", isOptimized: true,
> > +emissionKind: 1, file: !1, enums: !2, retainedTypes: !22,
> > +subprograms: !3, globals: !2, imports: !2)
> >  !1 = !DIFile(filename: "debug-dead-local-var.c", directory:
> > "/usr/local/google/home/echristo")
> >  !2 = !{}
> >  !3 = !{!4, !9}
> > @@ -49,3 +49,4 @@ attributes #0 = { nounwind readnone uwta
> >  !19 = !{i32 2, !"Debug Info Version", i32 3}
> >  !20 = !{!"clang version 3.5.0 (trunk 209255) (llvm/trunk 209253)"}
> >  !21 = !DILocation(line: 13, scope: !4)
> > +!22 = !{!14}
> >
> > Modified: llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/gnu-
> > public-names.ll?rev=263424&r1=263423&r2=263424&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll (original)
> > +++ llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll Mon Mar 14
> > +++ 07:03:20 2016
> > @@ -123,17 +123,6 @@
> >  ; CHECK: DW_AT_linkage_name
> >  ; CHECK-NOT: DW_TAG
> >  ; CHECK: DW_AT_name {{.*}} "global_namespace_function"
> > -
> > -; CHECK: DW_TAG_subprogram
> > -; CHECK-NOT: DW_TAG
> > -; CHECK:   DW_AT_name {{.*}} "f3"
> > -; CHECK-NOT: {{DW_TAG|NULL}}
> > -; CHECK: [[F3_Z:.*]]:   DW_TAG_variable
> > -; CHECK-NOT: DW_TAG
> > -; CHECK:     DW_AT_name {{.*}} "z"
> > -; CHECK-NOT: {{DW_TAG|NULL}}
> > -; CHECK:     DW_AT_location
> > -; CHECK-NOT: {{DW_TAG|NULL}}
> >  ; CHECK:   NULL
> >  ; CHECK-NOT: {{DW_TAG|NULL}}
> >
> > @@ -194,6 +183,18 @@
> >  ; CHECK-NOT: DW_TAG
> >  ; CHECK: DW_AT_name {{.*}} "global_function"
> >
> > +; CHECK: DW_TAG_subprogram
> > +; CHECK-NOT: DW_TAG
> > +; CHECK:   DW_AT_name {{.*}} "f3"
> > +; CHECK-NOT: {{DW_TAG|NULL}}
> > +; CHECK: [[F3_Z:.*]]:   DW_TAG_variable
> > +; CHECK-NOT: DW_TAG
> > +; CHECK:     DW_AT_name {{.*}} "z"
> > +; CHECK-NOT: {{DW_TAG|NULL}}
> > +; CHECK:     DW_AT_location
> > +; CHECK-NOT: {{DW_TAG|NULL}}
> > +; CHECK:   NULL
> > +
> >  ; CHECK-LABEL: .debug_gnu_pubnames contents:
> >  ; CHECK-NEXT: length = {{.*}} version = 0x0002 unit_offset = 0x00000000
> unit_size = {{.*}}
> >  ; CHECK-NEXT: Offset     Linkage  Kind     Name
> > @@ -201,12 +202,12 @@
> >  ; CHECK-NEXT:  [[NS]] EXTERNAL TYPE     "ns"
> >  ; CHECK-NEXT:  [[OUTER_ANON_C]] STATIC VARIABLE "outer::(anonymous
> namespace)::c"
> >  ; CHECK-NEXT:  [[ANON_I]] STATIC VARIABLE "(anonymous namespace)::i"
> > +; CHECK-NEXT:  [[ANON]] EXTERNAL TYPE "(anonymous namespace)"
> >  ; GCC Doesn't put local statics in pubnames, but it seems not
> > unreasonable and  ; comes out naturally from LLVM's implementation, so
> > I'm OK with it for now. If  ; it's demonstrated that this is a major
> > size concern or degrades debug info  ; consumer behavior, feel free to
> change it.
> >  ; CHECK-NEXT:  [[F3_Z]] STATIC VARIABLE "f3::z"
> > -; CHECK-NEXT:  [[ANON]] EXTERNAL TYPE "(anonymous namespace)"
> >  ; CHECK-NEXT:  [[OUTER_ANON]] EXTERNAL TYPE "outer::(anonymous
> namespace)"
> >  ; CHECK-NEXT:  [[ANON_INNER_B]] STATIC VARIABLE "(anonymous
> namespace)::inner::b"
> >  ; CHECK-NEXT:  [[OUTER]] EXTERNAL TYPE "outer"
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the llvm-commits mailing list