[llvm] r263437 - Revert "Recommitted r261633 "Supporting all entities declared in lexical scope in LLVM debug info." After fixing PR26715 at r263379."

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 07:58:36 PDT 2016


Author: d0k
Date: Mon Mar 14 09:58:36 2016
New Revision: 263437

URL: http://llvm.org/viewvc/llvm-project?rev=263437&view=rev
Log:
Revert "Recommitted r261633 "Supporting all entities declared in lexical scope in LLVM debug info." After fixing PR26715 at r263379."

This reverts commit r263424. Breaks self-host.

Removed:
    llvm/trunk/test/DebugInfo/X86/PR24008.ll
    llvm/trunk/test/DebugInfo/X86/lexical-block-inline.ll
    llvm/trunk/test/DebugInfo/X86/lexical-block.ll
    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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Mar 14 09:58:36 2016
@@ -114,16 +114,10 @@ DIE *DwarfCompileUnit::getOrCreateGlobal
 
   // 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.
-  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);
+  DIE *ContextDIE = getOrCreateContextDIE(GVContext);
 
+  // Add to map.
+  DIE *VariableDIE = &createAndAddDIE(GV->getTag(), *ContextDIE, GV);
   DIScope *DeclContext;
   if (auto *SDMDecl = GV->getStaticDataMemberDeclaration()) {
     DeclContext = resolve(SDMDecl->getScope());
@@ -341,15 +335,23 @@ void DwarfCompileUnit::constructScopeDIE
     if (DD->isLexicalScopeDIENull(Scope))
       return;
 
-    bool HasNonScopeChildren;
+    unsigned ChildScopeCount;
 
     // 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, &HasNonScopeChildren);
+    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)));
+    }
 
     // If there are only other scopes as children, put them directly in the
     // parent instead, as this scope would serve no purpose.
-    if (!HasNonScopeChildren) {
+    if (Children.size() == ChildScopeCount) {
       FinalChildren.insert(FinalChildren.end(),
                            std::make_move_iterator(Children.begin()),
                            std::make_move_iterator(Children.end()));
@@ -364,7 +366,6 @@ void DwarfCompileUnit::constructScopeDIE
     ScopeDIE->addChild(std::move(I));
 
   FinalChildren.push_back(std::move(ScopeDIE));
-  addLocalScopeDieToLexicalScope(Scope, ScopeDIE);
 }
 
 DIE::value_iterator
@@ -557,37 +558,20 @@ DIE *DwarfCompileUnit::constructVariable
 
 DIE *DwarfCompileUnit::createScopeChildrenDIE(LexicalScope *Scope,
                                               SmallVectorImpl<DIE *> &Children,
-                                              bool *HasNonScopeChildren) {
+                                              unsigned *ChildScopeCount) {
   DIE *ObjectPointer = nullptr;
-  bool HasLocalDclDie = false;
-  auto *DS = Scope->getScopeNode();
 
   for (DbgVariable *DV : DU->getScopeVariables().lookup(Scope))
     Children.push_back(constructVariableDIE(*DV, *Scope, ObjectPointer));
 
-  // 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;
+  unsigned ChildCountWithoutScopes = Children.size();
 
   for (LexicalScope *LS : Scope->getChildren())
     constructScopeDIE(LS, Children);
 
+  if (ChildScopeCount)
+    *ChildScopeCount = Children.size() - ChildCountWithoutScopes;
+
   return ObjectPointer;
 }
 
@@ -629,8 +613,6 @@ DIE *DwarfCompileUnit::createAndAddScope
   for (auto &I : Children)
     ScopeDIE.addChild(std::move(I));
 
-  addLocalScopeDieToLexicalScope(Scope, &ScopeDIE);
-
   return ObjectPointer;
 }
 
@@ -667,20 +649,10 @@ 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) {
-
-  assert(!getDIE(Module));
-
-  DIE *IMDie = createDIE(Module->getTag(), Module);
+  DIE *IMDie = DIE::get(DIEValueAllocator, (dwarf::Tag)Module->getTag());
+  insertDIE(Module, IMDie);
   DIE *EntityDie;
   auto *Entity = resolve(Module->getEntity());
   if (auto *NS = dyn_cast<DINamespace>(Entity))
@@ -707,46 +679,22 @@ DIE *DwarfCompileUnit::constructImported
 }
 
 void DwarfCompileUnit::finishSubprogramDefinition(const DISubprogram *SP) {
-  if (DIE *D = getDIE(SP)) {
-    if (DIE *AbsSPDIE = DU->getAbstractSPDies().lookup(SP))
+  DIE *D = getDIE(SP);
+  if (DIE *AbsSPDIE = DU->getAbstractSPDies().lookup(SP)) {
+    if (D)
       // If this subprogram has an abstract definition, reference that
       addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
-    else
+  } 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)
       // 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() &&
@@ -757,7 +705,7 @@ void DwarfCompileUnit::collectDeadVariab
 
   DIE *SPDIE = DU->getAbstractSPDies().lookup(SP);
   if (!SPDIE)
-    return;
+    SPDIE = getDIE(SP);
   assert(SPDIE);
   for (const DILocalVariable *DV : Variables) {
     DbgVariable NewVar(DV, /* IA */ nullptr, DD);
@@ -882,30 +830,6 @@ 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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Mon Mar 14 09:58:36 2016
@@ -15,7 +15,6 @@
 #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"
@@ -49,10 +48,11 @@ class DwarfCompileUnit : public DwarfUni
   /// The start of the unit macro info within macro section.
   MCSymbol *MacroLabelBegin;
 
-  typedef llvm::SmallVector<const MDNode *, 8> LocalDeclNodeList;
-  typedef llvm::DenseMap<const MDNode *, LocalDeclNodeList> LocalScopesMap;
+  typedef llvm::SmallVector<const MDNode *, 8> ImportedEntityList;
+  typedef llvm::DenseMap<const MDNode *, ImportedEntityList>
+  ImportedEntityMap;
 
-  LocalScopesMap LocalDeclNodes;
+  ImportedEntityMap ImportedEntities;
 
   /// GlobalNames - A map of globally visible named entities for this unit.
   StringMap<const DIE *> GlobalNames;
@@ -71,15 +71,6 @@ 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);
@@ -126,8 +117,8 @@ public:
 
   unsigned getOrCreateSourceID(StringRef FileName, StringRef DirName) override;
 
-  void addLocalDeclNode(const DINode *DI, DILocalScope *Scope) {
-    LocalDeclNodes[Scope].push_back(DI);
+  void addImportedEntity(const DIImportedEntity* IE) {
+    ImportedEntities[IE->getScope()].push_back(IE);
   }
 
   /// addRange - Add an address range to the list of ranges for this unit.
@@ -175,7 +166,7 @@ public:
   /// A helper function to create children of a Scope DIE.
   DIE *createScopeChildrenDIE(LexicalScope *Scope,
                               SmallVectorImpl<DIE *> &Children,
-                              bool *HasNonScopeChildren = nullptr);
+                              unsigned *ChildScopeCount = nullptr);
 
   /// \brief Construct a DIE for this subprogram scope.
   void constructSubprogramScopeDIE(LexicalScope *Scope);
@@ -184,15 +175,11 @@ 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.
@@ -266,15 +253,6 @@ 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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Mar 14 09:58:36 2016
@@ -455,16 +455,6 @@ 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.
@@ -484,9 +474,10 @@ 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())
-      if (!collectLocalScopedNode(GV->getScope(), GV, CU))
-        CU.getOrCreateGlobalVariableDIE(GV);
+      CU.getOrCreateGlobalVariableDIE(GV);
     for (auto *SP : CUNode->getSubprograms())
       SPMap.insert(std::make_pair(SP, &CU));
     for (auto *Ty : CUNode->getEnumTypes()) {
@@ -498,17 +489,14 @@ 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())
-      if (!collectLocalScopedNode(IE->getScope(), IE, CU))
-        constructAndAddImportedEntityDIE(CU, IE);
+      constructAndAddImportedEntityDIE(CU, IE);
   }
 
   // Tell MMI that we have debug info.
@@ -541,11 +529,6 @@ 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();
@@ -571,8 +554,6 @@ void DwarfDebug::finalizeModuleInfo() {
 
   finishSubprogramDefinitions();
 
-  finishLocalScopeDefinitions();
-
   finishVariableDefinitions();
 
   // Collect info for variables that were optimized out.
@@ -1183,9 +1164,6 @@ 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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Mar 14 09:58:36 2016
@@ -211,10 +211,6 @@ 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;
@@ -331,8 +327,6 @@ class DwarfDebug : public DebugHandlerBa
 
   void finishSubprogramDefinitions();
 
-  void finishLocalScopeDefinitions();
-
   /// Finish off debug information after all functions have been
   /// processed.
   void finalizeModuleInfo();
@@ -431,11 +425,6 @@ 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.
@@ -578,12 +567,6 @@ 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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Mon Mar 14 09:58:36 2016
@@ -298,15 +298,10 @@ void DwarfUnit::addDIEEntry(DIE &Die, dw
                Entry);
 }
 
-DIE *DwarfUnit::createDIE(unsigned Tag, const DINode *N) {
-  DIE *Die = DIE::get(DIEValueAllocator, (dwarf::Tag)Tag);
-  if (N)
-    insertDIE(N, Die);
-  return Die;
-}
-
 DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) {
-  DIE &Die = Parent.addChild(createDIE(Tag, N));
+  DIE &Die = Parent.addChild(DIE::get(DIEValueAllocator, (dwarf::Tag)Tag));
+  if (N)
+    insertDIE(N, &Die);
   return Die;
 }
 
@@ -732,18 +727,15 @@ 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());
-  bool IsLocalScope = Context && isa<DILocalScope>(Context);
-  DIE *ContextDIE = IsLocalScope ? nullptr : getOrCreateContextDIE(Context);
-  assert(ContextDIE || IsLocalScope);
+  DIE *ContextDIE = getOrCreateContextDIE(Context);
+  assert(ContextDIE);
 
   if (DIE *TyDIE = getDIE(Ty))
     return TyDIE;
 
-  // Create new type and add to map.
-  DIE &TyDIE = IsLocalScope ? *createDIE(Ty->getTag(), Ty)
-                            : createAndAddDIE(Ty->getTag(), *ContextDIE, Ty);
+  // Create new type.
+  DIE &TyDIE = 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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Mon Mar 14 09:58:36 2016
@@ -298,9 +298,6 @@ 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=263437&r1=263436&r2=263437&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 09:58:36 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: !41, 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: !39, 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,4 +112,3 @@ 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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll Mon Mar 14 09:58:36 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: !61, 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: !20, 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,7 +39,6 @@ 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=263437&r1=263436&r2=263437&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 09:58:36 2016
@@ -32,7 +32,7 @@
 ; CHECK:     DW_AT_name {{.*}} "func"
 ; CHECK: DW_TAG_compile_unit
 
-; Check that the subprogram is dropped in this CU - since the function was
+; FIXME: Maybe we should drop the subprogram here - 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-NOT: DW_TAG_subprogram
+; CHECK: 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 = !{!0, !12}
+!llvm.dbg.cu = !{!12, !0}
 !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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/namespace.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/namespace.ll Mon Mar 14 09:58:36 2016
@@ -23,11 +23,6 @@
 ; 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
@@ -50,6 +45,11 @@
 ; 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,23 +71,10 @@
 
 ; 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)
@@ -147,6 +134,13 @@
 ; 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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/nodebug.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/nodebug.ll Mon Mar 14 09:58:36 2016
@@ -16,8 +16,10 @@
 ;   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 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-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/InlinedFnLocalVar.ll?rev=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Mips/InlinedFnLocalVar.ll (original)
+++ llvm/trunk/test/DebugInfo/Mips/InlinedFnLocalVar.ll Mon Mar 14 09:58:36 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: !61, 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: !20, 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,7 +39,6 @@ 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/InlinedFnLocalVar.ll?rev=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/InlinedFnLocalVar.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/InlinedFnLocalVar.ll Mon Mar 14 09:58:36 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: !111, 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: !20, 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,7 +39,6 @@ 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)

Removed: llvm/trunk/test/DebugInfo/X86/PR24008.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/PR24008.ll?rev=263436&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/PR24008.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/PR24008.ll (removed)
@@ -1,67 +0,0 @@
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj -O0 < %s  | llvm-dwarfdump -debug-dump=info - | FileCheck %s
-
-;; This test checks the following:
-;; 1. Compilation does not crash
-;; 2. "f1" function is defined.
-;; 3. "nested::f2" function is not defined.
-;;
-;; This test was generated by running following command:
-;; clang -cc1 -O0 -g -emit-llvm foo.cpp -o - | opt -S -inline -sroa
-;; Where test.cpp
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;void f1() {
-;;  while (true) {
-;;    struct nested {
-;;      static void f2() {}
-;;    };
-;;    nested::f2();
-;;  }
-;;}
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; CHECK:      DW_TAG_compile_unit
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        DW_TAG_subprogram
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_name {{.*}} "f1"
-; CHECK:        NULL
-
-; CHECK-NOT: DW_TAG_subprogram
-
-
-; Function Attrs: nounwind
-define void @_Z2f1v() #0 !dbg !6 {
-entry:
-  br label %while.body, !dbg !16
-
-while.body:                                       ; preds = %while.body, %entry
-  br label %while.body, !dbg !16
-
-return:                                           ; No predecessors!
-  ret void, !dbg !17
-}
-
-attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!13, !14}
-!llvm.ident = !{!15}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242994) (llvm/trunk 242995)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !11)
-!1 = !DIFile(filename: "foo.cpp", directory: "/")
-!2 = !{}
-!3 = !{!4}
-!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "nested", scope: !5, file: !1, line: 3, size: 8, align: 8, elements: !9)
-!5 = distinct !DILexicalBlock(scope: !6, file: !1, line: 2)
-!6 = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
-!7 = !DISubroutineType(types: !8)
-!8 = !{null}
-!9 = !{!10}
-!10 = distinct !DISubprogram(name: "f2", scope: !4, file: !1, line: 4, type: !7, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)
-!11 = !{!6, !12}
-!12 = distinct !DISubprogram(name: "f2", linkageName: "_ZZ2f1vEN6nested2f2Ev", scope: !4, file: !1, line: 4, type: !7, isLocal: true, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, declaration: !10, variables: !2)
-!13 = !{i32 2, !"Dwarf Version", i32 4}
-!14 = !{i32 2, !"Debug Info Version", i32 3}
-!15 = !{!"clang version 3.8.0 (trunk 242994) (llvm/trunk 242995)"}
-!16 = !DILocation(line: 2, scope: !6)
-!17 = !DILocation(line: 8, scope: !6)

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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-file-name.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-file-name.ll Mon Mar 14 09:58:36 2016
@@ -6,7 +6,7 @@
 declare i32 @printf(i8*, ...) nounwind
 
 define i32 @main() nounwind !dbg !6 {
-  ret i32 0, !dbg !13
+  ret i32 0
 }
 
 !llvm.dbg.cu = !{!2}
@@ -22,4 +22,3 @@ 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/debug-dead-local-var.ll?rev=263437&r1=263436&r2=263437&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 09:58:36 2016
@@ -11,9 +11,9 @@
 ;   return 1;
 ; }
 
-; 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
+; 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
 
 ; 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: !22, 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: !2, 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,4 +49,3 @@ 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=263437&r1=263436&r2=263437&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll Mon Mar 14 09:58:36 2016
@@ -123,6 +123,17 @@
 ; 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}}
 
@@ -183,18 +194,6 @@
 ; 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
@@ -202,12 +201,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"

Removed: llvm/trunk/test/DebugInfo/X86/lexical-block-inline.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/lexical-block-inline.ll?rev=263436&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/lexical-block-inline.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/lexical-block-inline.ll (removed)
@@ -1,198 +0,0 @@
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj -O0 < %s  | llvm-dwarfdump -debug-dump=info - | FileCheck %s
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -split-dwarf=Enable -filetype=obj -O0 < %s  | llvm-dwarfdump -debug-dump=info.dwo - | FileCheck %s
-
-;; This test checks the following:
-;; 1. Useless lexical block entry is not emitted.
-;; 2. Function static variable, typedef, records (structure, class and union)
-;;    that are defined in lexical basic block are emitted as children to
-;;    these lexical blocks.
-;;    * For typedef and record check that both are emitted in lexical block
-;;      where they are declared and not in the one where they are used.
-;; 3. "bar" function, which was inlined into "foo" function, is created as
-;;    abstract (with DW_AT_inline attribute).
-;;    All variables and types are defined in this abstract entry.
-;; 4. "bar" function is created in "foo" function as inlined function
-;;    (with DW_TAG_inlined_subroutine attribute), and all its local variables
-;;    are created as concrete variables pointing to the abstract suitable entry
-;;    defined under abstract "bar" function.
-;; 5. Lexical block entries created in the inline "bar" function entry have
-;;    "DW_AT_abstract_origin" attribute pointing to the equivalent abstract
-;;    lexical block entry.
-;;
-;; This test was generated by running following command:
-;; clang -cc1 -O0 -g -emit-llvm foo.cpp -o - | opt -S -inline -sroa
-;; Where foo.cpp
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;__inline int bar(int s) {
-;;  {
-;;    {
-;;      struct X {
-;;          int x;
-;;      };
-;;      typedef int Y;
-;;      {
-;;        X a = { s };
-;;        Y b(s);
-;;        static int c = 0;
-;;        return a.x + b + c++;
-;;      }
-;;    }
-;;  }
-;;}
-;;
-;;
-;;int foo(int i) {
-;;  return
-;;    bar(i);
-;;}
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; CHECK:    [[Offset_bar:0x[0-9abcdef]+]]: DW_TAG_subprogram
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:      DW_AT_name {{.*}} "bar"
-; CHECK:      DW_AT_inline
-; CHECK-NOT: NULL
-; CHECK:      DW_TAG_lexical_block
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        [[Offset_LB2:0x[0-9abcdef]+]]: DW_TAG_lexical_block
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        [[Offset_a:0x[0-9abcdef]+]]: DW_TAG_variable
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_name {{.*}} "a"
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        [[Offset_b:0x[0-9abcdef]+]]: DW_TAG_variable
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_name {{.*}} "b"
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        [[Offset_c:0x[0-9abcdef]+]]: DW_TAG_variable
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_name {{.*}} "c"
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_location
-
-; CHECK-NOT: {{DW_TAG}}
-; CHECK:        NULL
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:      [[Offset_X:0x[0-9abcdef]+]]: DW_TAG_structure_type
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        DW_AT_name {{.*}} "X"
-; CHECK:        NULL
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:      [[Offset_Y:0x[0-9abcdef]+]]: DW_TAG_typedef
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        DW_AT_name {{.*}} "Y"
-
-; CHECK-NOT: {{DW_TAG}}
-; CHECK:      NULL
-
-
-; CHECK:    DW_TAG_subprogram
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:      DW_AT_name {{.*}} "foo"
-; CHECK-NOT: {{NULL}}
-; CHECK:      DW_TAG_inlined_subroutine
-; CHECK-NEXT:   DW_AT_abstract_origin {{.*}} {[[Offset_bar]]}
-
-; CHECK-NOT: {{NULL}}
-; CHECK:        DW_TAG_lexical_block
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        DW_TAG_lexical_block
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:       DW_AT_abstract_origin {{.*}} {[[Offset_LB2]]}
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_TAG_variable
-; CHECK-NEXT:       DW_AT_location
-; CHECK-NEXT:       DW_AT_abstract_origin {{.*}} {[[Offset_a]]}
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_TAG_variable
-; CHECK-NEXT:       DW_AT_location
-; CHECK-NEXT:       DW_AT_abstract_origin {{.*}} {[[Offset_b]]}
-
-; CHECK-NOT: {{DW_TAG}}
-; CHECK:      NULL
-
-; CHECK-NOT: {{DW_TAG}}
-; CHECK:      NULL
-
-%struct.X = type { i32 }
-
-$_ZZ3bariE1c = comdat any
-
- at _ZZ3bariE1c = linkonce_odr global i32 0, comdat, align 4
-
-; Function Attrs: nounwind
-define i32 @_Z3fooi(i32 %i) #0 !dbg !15 {
-entry:
-  call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !22, metadata !23), !dbg !24
-  call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !25, metadata !23), !dbg !26
-  call void @llvm.dbg.declare(metadata %struct.X* undef, metadata !28, metadata !23), !dbg !29
-  call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !28, metadata !23), !dbg !29
-  call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !30, metadata !23), !dbg !31
-  %add.i = add nsw i32 %i, %i, !dbg !32
-  %0 = load i32, i32* @_ZZ3bariE1c, align 4, !dbg !32
-  %inc.i = add nsw i32 %0, 1, !dbg !32
-  store i32 %inc.i, i32* @_ZZ3bariE1c, align 4, !dbg !32
-  %add2.i = add nsw i32 %add.i, %0, !dbg !32
-  ret i32 %add2.i, !dbg !33
-}
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
-
-attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { nounwind readnone }
-
-!llvm.dbg.cu = !{!0, !34}
-!llvm.module.flags = !{!19, !20}
-!llvm.ident = !{!21}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242994) (llvm/trunk 242995)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !16)
-!1 = !DIFile(filename: "foo.cpp", directory: "/")
-!2 = !{}
-!3 = !{!4, !13}
-!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", scope: !5, file: !1, line: 4, size: 32, align: 32, elements: !11, identifier: "_ZTSZ3bariE1X")
-!5 = distinct !DILexicalBlock(scope: !6, file: !1, line: 3)
-!6 = distinct !DILexicalBlock(scope: !7, file: !1, line: 2)
-!7 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
-!8 = !DISubroutineType(types: !9)
-!9 = !{!10, !10}
-!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!11 = !{!12}
-!12 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !"_ZTSZ3bariE1X", file: !1, line: 5, baseType: !10, size: 32, align: 32)
-!13 = !DIDerivedType(tag: DW_TAG_typedef, name: "Y", scope: !5, file: !1, line: 7, baseType: !10)
-!14 = !{!15, !7}
-!15 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !1, file: !1, line: 19, type: !8, isLocal: false, isDefinition: true, scopeLine: 19, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
-!16 = !{!17}
-!17 = !DIGlobalVariable(name: "c", scope: !18, file: !1, line: 11, type: !10, isLocal: false, isDefinition: true, variable: i32* @_ZZ3bariE1c)
-!18 = distinct !DILexicalBlock(scope: !5, file: !1, line: 8)
-!19 = !{i32 2, !"Dwarf Version", i32 4}
-!20 = !{i32 2, !"Debug Info Version", i32 3}
-!21 = !{!"clang version 3.8.0 (trunk 242994) (llvm/trunk 242995)"}
-!22 = !DILocalVariable(name: "i", arg: 1, scope: !15, file: !1, line: 19, type: !10)
-!23 = !DIExpression()
-!24 = !DILocation(line: 19, scope: !15)
-!25 = !DILocalVariable(name: "s", arg: 1, scope: !7, file: !1, line: 1, type: !10)
-!26 = !DILocation(line: 1, scope: !7, inlinedAt: !27)
-!27 = distinct !DILocation(line: 21, scope: !15)
-!28 = !DILocalVariable(name: "a", scope: !18, file: !1, line: 9, type: !"_ZTSZ3bariE1X")
-!29 = !DILocation(line: 9, scope: !18, inlinedAt: !27)
-!30 = !DILocalVariable(name: "b", scope: !18, file: !1, line: 10, type: !13)
-!31 = !DILocation(line: 10, scope: !18, inlinedAt: !27)
-!32 = !DILocation(line: 12, scope: !18, inlinedAt: !27)
-!33 = !DILocation(line: 20, scope: !15)
-
-; This line is manually added to check that the test does not crash when having
-; more than one compile unit!
-!34 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242994) (llvm/trunk 242995)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !2, globals: !2)

Removed: llvm/trunk/test/DebugInfo/X86/lexical-block.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/lexical-block.ll?rev=263436&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/lexical-block.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/lexical-block.ll (removed)
@@ -1,131 +0,0 @@
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj -O0 < %s  | llvm-dwarfdump -debug-dump=info - | FileCheck %s
-
-;; This test checks the following:
-;; 1. Useless lexical block entry is not emitted.
-;; 2. Function static variable, typedef, records (structure, class and union)
-;;    that are defined in lexical basic block are emitted as children to
-;;    these lexical blocks.
-;;    * For typedef and record check that both are emitted in lexical block
-;;      where they are declared and not in the one where they are used.
-;;
-;; This test was generated by running following command:
-;; clang -cc1 -O0 -g -emit-llvm foo.cpp 
-;; Where foo.cpp
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;int foo(void) { 
-;;  {
-;;    {
-;;      struct X {
-;;        int x;
-;;      };
-;;      typedef int Y;
-;;      {
-;;        X a;
-;;        Y b;
-;;        static int c;
-;;        return a.x + b + c;
-;;      }
-;;    }
-;;  }
-;;}
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
-; CHECK:    DW_TAG_subprogram
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:      DW_AT_name {{.*}} "foo"
-; CHECK-NOT: NULL
-; CHECK:      DW_TAG_lexical_block
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        DW_TAG_lexical_block
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_TAG_variable
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:            DW_AT_name {{.*}} "a"
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_TAG_variable
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:            DW_AT_name {{.*}} "b"
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_TAG_variable
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:            DW_AT_name {{.*}} "c"
-
-; CHECK-NOT: {{DW_TAG}}
-; CHECK:          NULL
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        DW_TAG_structure_type
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_name {{.*}} "X"
-; CHECK:          NULL
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        DW_TAG_typedef
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_name {{.*}} "Y"
-
-; CHECK-NOT: {{DW_TAG}}
-; CHECK:          NULL
-
-%struct.X = type { i32 }
-
- at _ZZ3foovE1c = internal global i32 0, align 4
-
-; Function Attrs: nounwind
-define i32 @_Z3foov() #0 !dbg !7 {
-entry:
-  %a = alloca %struct.X, align 4
-  %b = alloca i32, align 4
-  call void @llvm.dbg.declare(metadata %struct.X* %a, metadata !21, metadata !22), !dbg !23
-  call void @llvm.dbg.declare(metadata i32* %b, metadata !24, metadata !22), !dbg !25
-  %x = getelementptr inbounds %struct.X, %struct.X* %a, i32 0, i32 0, !dbg !26
-  %0 = load i32, i32* %x, align 4, !dbg !26
-  %1 = load i32, i32* %b, align 4, !dbg !26
-  %add = add nsw i32 %0, %1, !dbg !26
-  %2 = load i32, i32* @_ZZ3foovE1c, align 4, !dbg !26
-  %add1 = add nsw i32 %add, %2, !dbg !26
-  ret i32 %add1, !dbg !26
-}
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
-attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { nounwind readnone }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!18, !19}
-!llvm.ident = !{!20}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.7.0 (trunk 237245)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !15, imports: !2)
-!1 = !DIFile(filename: "foo.cpp", directory: "/")
-!2 = !{}
-!3 = !{!4, !13}
-!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", scope: !5, file: !1, line: 4, size: 32, align: 32, elements: !11)
-!5 = distinct !DILexicalBlock(scope: !6, file: !1, line: 3)
-!6 = distinct !DILexicalBlock(scope: !7, file: !1, line: 2)
-!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
-!8 = !DISubroutineType(types: !9)
-!9 = !{!10}
-!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!11 = !{!12}
-!12 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !4, file: !1, line: 5, baseType: !10, size: 32, align: 32)
-!13 = !DIDerivedType(tag: DW_TAG_typedef, name: "Y", scope: !5, file: !1, line: 7, baseType: !10)
-!14 = !{!7}
-!15 = !{!16}
-!16 = !DIGlobalVariable(name: "c", scope: !17, file: !1, line: 11, type: !10, isLocal: true, isDefinition: true, variable: i32* @_ZZ3foovE1c)
-!17 = distinct !DILexicalBlock(scope: !5, file: !1, line: 8)
-!18 = !{i32 2, !"Dwarf Version", i32 4}
-!19 = !{i32 2, !"Debug Info Version", i32 3}
-!20 = !{!"clang version 3.7.0 (trunk 237245)"}
-!21 = !DILocalVariable(name: "a", scope: !17, file: !1, line: 9, type: !4)
-!22 = !DIExpression()
-!23 = !DILocation(line: 9, scope: !17)
-!24 = !DILocalVariable(name: "b", scope: !17, file: !1, line: 10, type: !13)
-!25 = !DILocation(line: 10, scope: !17)
-!26 = !DILocation(line: 12, scope: !17)

Removed: llvm/trunk/test/DebugInfo/X86/subprogram-inline.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/subprogram-inline.ll?rev=263436&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/subprogram-inline.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/subprogram-inline.ll (removed)
@@ -1,169 +0,0 @@
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj -O0 < %s  | llvm-dwarfdump -debug-dump=info - | FileCheck %s
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -split-dwarf=Enable -filetype=obj -O0 < %s  | llvm-dwarfdump -debug-dump=info.dwo - | FileCheck %s
-
-;; This test checks the following:
-;; 2. Function static variable, typedef, records (structure, class and union)
-;;    that are defined in lexical function scope are emitted as children to
-;;    the function scope, directly.
-;; 3. "bar" function, which was inlined into "foo" function, is created as
-;;    abstract (with DW_AT_inline attribute).
-;;    All variables and types are defined in this abstract entry.
-;; 4. "bar" function is created in "foo" function as inlined function
-;;    (with DW_TAG_inlined_subroutine attribute), and all its local variables
-;;    are created as concrete variables pointing to the abstract suitable entry
-;;    defined under abstract "bar" function.
-;;
-;; This test was generated by running following command:
-;; clang -cc1 -O0 -g -emit-llvm foo.cpp -o - | opt -S -inline -sroa
-;; Where foo.cpp
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;__inline int bar(int s) {
-;;
-;;
-;;      struct X {
-;;          int x;
-;;      };
-;;      typedef int Y;
-;;
-;;        X a = { s };
-;;        Y b(s);
-;;        static int c = 0;
-;;        return a.x + b + c++;
-;;
-;;
-;;
-;;}
-;;
-;;
-;;int foo(int i) {
-;;  return
-;;    bar(i);
-;;}
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; CHECK:    [[Offset_bar:0x[0-9abcdef]+]]: DW_TAG_subprogram
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:      DW_AT_name {{.*}} "bar"
-; CHECK:      DW_AT_inline
-; CHECK-NOT: NULL
-
-; CHECK:        [[Offset_a:0x[0-9abcdef]+]]: DW_TAG_variable
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_name {{.*}} "a"
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        [[Offset_b:0x[0-9abcdef]+]]: DW_TAG_variable
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_name {{.*}} "b"
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        [[Offset_c:0x[0-9abcdef]+]]: DW_TAG_variable
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_name {{.*}} "c"
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_AT_location
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:      [[Offset_X:0x[0-9abcdef]+]]: DW_TAG_structure_type
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        DW_AT_name {{.*}} "X"
-; CHECK:        NULL
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:      [[Offset_Y:0x[0-9abcdef]+]]: DW_TAG_typedef
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:        DW_AT_name {{.*}} "Y"
-
-; CHECK-NOT: {{DW_TAG}}
-; CHECK:      NULL
-
-
-; CHECK:    DW_TAG_subprogram
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:      DW_AT_name {{.*}} "foo"
-; CHECK-NOT: {{NULL}}
-; CHECK:      DW_TAG_inlined_subroutine
-; CHECK-NEXT:   DW_AT_abstract_origin {{.*}} {[[Offset_bar]]}
-
-; CHECK-NOT: {{NULL}}
-; CHECK:          DW_TAG_variable
-; CHECK-NEXT:       DW_AT_location
-; CHECK-NEXT:       DW_AT_abstract_origin {{.*}} {[[Offset_a]]}
-
-; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:          DW_TAG_variable
-; CHECK-NEXT:       DW_AT_location
-; CHECK-NEXT:       DW_AT_abstract_origin {{.*}} {[[Offset_b]]}
-
-; CHECK-NOT: {{DW_TAG}}
-; CHECK:      NULL
-
-%struct.X = type { i32 }
-
-$_ZZ3bariE1c = comdat any
-
- at _ZZ3bariE1c = linkonce_odr global i32 0, comdat, align 4
-
-; Function Attrs: nounwind
-define i32 @_Z3fooi(i32 %i) #0 !dbg !13 {
-entry:
-  call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !18, metadata !19), !dbg !20
-  call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !21, metadata !19), !dbg !22
-  call void @llvm.dbg.declare(metadata %struct.X* undef, metadata !24, metadata !19), !dbg !25
-  call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !24, metadata !19), !dbg !25
-  call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !26, metadata !19), !dbg !27
-  %add.i = add nsw i32 %i, %i, !dbg !28
-  %0 = load i32, i32* @_ZZ3bariE1c, align 4, !dbg !28
-  %inc.i = add nsw i32 %0, 1, !dbg !28
-  store i32 %inc.i, i32* @_ZZ3bariE1c, align 4, !dbg !28
-  %add2.i = add nsw i32 %add.i, %0, !dbg !28
-  ret i32 %add2.i, !dbg !29
-}
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
-
-attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { nounwind readnone }
-
-!llvm.dbg.cu = !{!0, !30}
-!llvm.module.flags = !{!16}
-!llvm.ident = !{!17}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 256818)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !12, globals: !14)
-!1 = !DIFile(filename: "foo.cpp", directory: "/")
-!2 = !{}
-!3 = !{!4, !11}
-!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", scope: !5, file: !1, line: 4, size: 32, align: 32, elements: !9, identifier: "_ZTSZ3bariE1X")
-!5 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
-!6 = !DISubroutineType(types: !7)
-!7 = !{!8, !8}
-!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!9 = !{!10}
-!10 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !"_ZTSZ3bariE1X", file: !1, line: 5, baseType: !8, size: 32, align: 32)
-!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "Y", scope: !5, file: !1, line: 7, baseType: !8)
-!12 = !{!13, !5}
-!13 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !1, file: !1, line: 19, type: !6, isLocal: false, isDefinition: true, scopeLine: 19, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
-!14 = !{!15}
-!15 = !DIGlobalVariable(name: "c", scope: !5, file: !1, line: 11, type: !8, isLocal: false, isDefinition: true, variable: i32* @_ZZ3bariE1c)
-!16 = !{i32 2, !"Debug Info Version", i32 3}
-!17 = !{!"clang version 3.8.0 (trunk 256818)"}
-!18 = !DILocalVariable(name: "i", arg: 1, scope: !13, file: !1, line: 19, type: !8)
-!19 = !DIExpression()
-!20 = !DILocation(line: 19, scope: !13)
-!21 = !DILocalVariable(name: "s", arg: 1, scope: !5, file: !1, line: 1, type: !8)
-!22 = !DILocation(line: 1, scope: !5, inlinedAt: !23)
-!23 = distinct !DILocation(line: 21, scope: !13)
-!24 = !DILocalVariable(name: "a", scope: !5, file: !1, line: 9, type: !"_ZTSZ3bariE1X")
-!25 = !DILocation(line: 9, scope: !5, inlinedAt: !23)
-!26 = !DILocalVariable(name: "b", scope: !5, file: !1, line: 10, type: !11)
-!27 = !DILocation(line: 10, scope: !5, inlinedAt: !23)
-!28 = !DILocation(line: 12, scope: !5, inlinedAt: !23)
-!29 = !DILocation(line: 20, scope: !13)
-
-; This line is manually added to check that the test does not crash when having
-; more than one compile unit!
-!30 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242994) (llvm/trunk 242995)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !2, globals: !2)




More information about the llvm-commits mailing list