Temporarily revert r191792 as it is causing some LTO debug failures
authorEric Christopher <echristo@gmail.com>
Fri, 4 Oct 2013 17:08:38 +0000 (17:08 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 4 Oct 2013 17:08:38 +0000 (17:08 +0000)
on platforms with relocations in debug info and also temporarily
revert r191800 due to conflicts with the revert of r191792.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191967 91177308-0d34-0410-b5e6-96231b3b80d8

13 files changed:
include/llvm/DebugInfo.h
lib/CodeGen/AsmPrinter/DIE.cpp
lib/CodeGen/AsmPrinter/DIE.h
lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h
lib/IR/DIBuilder.cpp
lib/IR/DebugInfo.cpp
test/Linker/Inputs/type-unique-simple2-a.ll [deleted file]
test/Linker/Inputs/type-unique-simple2-b.ll [deleted file]
test/Linker/type-unique-simple-a.ll
test/Linker/type-unique-simple2.ll [deleted file]
test/Transforms/LICM/debug-value.ll

index cd4777d7d6d071aab9b052675174e3619f107f7e..ecdca49558112f825e3c09afe87d9556ef9e9d52 100644 (file)
@@ -22,7 +22,6 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/IR/Metadata.h"
 #include "llvm/Support/Dwarf.h"
 
 namespace llvm {
@@ -207,8 +206,6 @@ namespace llvm {
     /// Gets the parent scope for this scope node or returns a
     /// default constructed scope.
     DIScopeRef getContext() const;
-    /// If the scope node has a name, return that, else return an empty string.
-    StringRef getName() const;
     StringRef getFilename() const;
     StringRef getDirectory() const;
 
@@ -246,16 +243,6 @@ namespace llvm {
              "MDNode in DITypeIdentifierMap should be a DIType.");
       return T(Iter->second);
     }
-    StringRef getName() const {
-      if (!Val)
-        return StringRef();
-
-      if (const MDNode *MD = dyn_cast<MDNode>(Val))
-        return T(MD).getName();
-
-      const MDString *MS = cast<MDString>(Val);
-      return MS->getString();
-    }
     operator Value *() const { return const_cast<Value*>(Val); }
   };
 
@@ -334,6 +321,9 @@ namespace llvm {
       return DbgNode && isType();
     }
 
+    /// isUnsignedDIType - Return true if type encoding is unsigned.
+    bool isUnsignedDIType();
+
     /// replaceAllUsesWith - Replace all uses of debug info referenced by
     /// this descriptor.
     void replaceAllUsesWith(DIDescriptor &D);
@@ -361,7 +351,11 @@ namespace llvm {
   public:
     explicit DIDerivedType(const MDNode *N = 0) : DIType(N) {}
 
-    DITypeRef getTypeDerivedFrom() const { return getFieldAs<DITypeRef>(9); }
+    DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); }
+
+    /// getOriginalTypeSize - If this type is derived from a base type then
+    /// return base type size.
+    uint64_t getOriginalTypeSize() const;
 
     /// getObjCProperty - Return property node, if this ivar is
     /// associated with one.
index 7a14be65e2a4d632fa78b7dd1fc00f6c0c12876e..7fb3c90dcb662faef35b235c7eb015174973e351 100644 (file)
@@ -113,21 +113,13 @@ DIE::~DIE() {
 /// Climb up the parent chain to get the compile unit DIE to which this DIE
 /// belongs.
 DIE *DIE::getCompileUnit() {
-  DIE *Cu = checkCompileUnit();
-  assert(Cu && "We should not have orphaned DIEs.");
-  return Cu;
-}
-
-/// Climb up the parent chain to get the compile unit DIE this DIE belongs
-/// to. Return NULL if DIE is not added to an owner yet.
-DIE *DIE::checkCompileUnit() {
   DIE *p = this;
   while (p) {
     if (p->getTag() == dwarf::DW_TAG_compile_unit)
       return p;
     p = p->getParent();
   }
-  return NULL;
+  llvm_unreachable("We should not have orphaned DIEs.");
 }
 
 DIEValue *DIE::findAttribute(uint16_t Attribute) {
index bff546f53088f1e3c861de991f7b8c691b24504c..9c6eaf3e4d593c7f07a39eead4a8e5d06b529f64 100644 (file)
@@ -152,9 +152,6 @@ namespace llvm {
     /// Climb up the parent chain to get the compile unit DIE this DIE belongs
     /// to.
     DIE *getCompileUnit();
-    /// Similar to getCompileUnit, returns null when DIE is not added to an
-    /// owner yet.
-    DIE *checkCompileUnit();
     void setTag(uint16_t Tag) { Abbrev.setTag(Tag); }
     void setOffset(unsigned O) { Offset = O; }
     void setSize(unsigned S) { Size = S; }
index 95d97c66175a27c8558fa16378c70b72cc435a64..cf926773d6c4a4e548ba024ca8a2f59206684d9d 100644 (file)
@@ -232,7 +232,7 @@ void CompileUnit::addDelta(DIE *Die, uint16_t Attribute, uint16_t Form,
 ///
 void CompileUnit::addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form,
                               DIE *Entry) {
-  DD->addDIEEntry(Die, Attribute, Form, createDIEEntry(Entry));
+  Die->addValue(Attribute, Form, createDIEEntry(Entry));
 }
 
 /// addBlock - Add block data.
@@ -524,7 +524,7 @@ void CompileUnit::addBlockByrefAddress(const DbgVariable &DV, DIE *Die,
 
   if (Tag == dwarf::DW_TAG_pointer_type) {
     DIDerivedType DTy = DIDerivedType(Ty);
-    TmpTy = DD->resolve(DTy.getTypeDerivedFrom());
+    TmpTy = DTy.getTypeDerivedFrom();
     isPointer = true;
   }
 
@@ -591,10 +591,9 @@ void CompileUnit::addBlockByrefAddress(const DbgVariable &DV, DIE *Die,
 }
 
 /// isTypeSigned - Return true if the type is signed.
-static bool isTypeSigned(DwarfDebug *DD, DIType Ty, int *SizeInBits) {
+static bool isTypeSigned(DIType Ty, int *SizeInBits) {
   if (Ty.isDerivedType())
-    return isTypeSigned(DD, DD->resolve(DIDerivedType(Ty).getTypeDerivedFrom()),
-                        SizeInBits);
+    return isTypeSigned(DIDerivedType(Ty).getTypeDerivedFrom(), SizeInBits);
   if (Ty.isBasicType())
     if (DIBasicType(Ty).getEncoding() == dwarf::DW_ATE_signed
         || DIBasicType(Ty).getEncoding() == dwarf::DW_ATE_signed_char) {
@@ -604,51 +603,6 @@ static bool isTypeSigned(DwarfDebug *DD, DIType Ty, int *SizeInBits) {
   return false;
 }
 
-/// Return true if type encoding is unsigned.
-static bool isUnsignedDIType(DwarfDebug *DD, DIType Ty) {
-  DIDerivedType DTy(Ty);
-  if (DTy.isDerivedType())
-    return isUnsignedDIType(DD, DD->resolve(DTy.getTypeDerivedFrom()));
-
-  DIBasicType BTy(Ty);
-  if (BTy.isBasicType()) {
-    unsigned Encoding = BTy.getEncoding();
-    if (Encoding == dwarf::DW_ATE_unsigned ||
-        Encoding == dwarf::DW_ATE_unsigned_char ||
-        Encoding == dwarf::DW_ATE_boolean)
-      return true;
-  }
-  return false;
-}
-
-/// If this type is derived from a base type then return base type size.
-static uint64_t getOriginalTypeSize(DwarfDebug *DD, DIDerivedType Ty) {
-  unsigned Tag = Ty.getTag();
-
-  if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
-      Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
-      Tag != dwarf::DW_TAG_restrict_type)
-    return Ty.getSizeInBits();
-
-  DIType BaseType = DD->resolve(Ty.getTypeDerivedFrom());
-
-  // If this type is not derived from any type then take conservative approach.
-  if (!BaseType.isValid())
-    return Ty.getSizeInBits();
-
-  // If this is a derived type, go ahead and get the base type, unless it's a
-  // reference then it's just the size of the field. Pointer types have no need
-  // of this since they're a different type of qualification on the type.
-  if (BaseType.getTag() == dwarf::DW_TAG_reference_type ||
-      BaseType.getTag() == dwarf::DW_TAG_rvalue_reference_type)
-    return Ty.getSizeInBits();
-
-  if (BaseType.isDerivedType())
-    return getOriginalTypeSize(DD, DIDerivedType(BaseType));
-
-  return BaseType.getSizeInBits();
-}
-
 /// addConstantValue - Add constant value entry in variable DIE.
 void CompileUnit::addConstantValue(DIE *Die, const MachineOperand &MO,
                                    DIType Ty) {
@@ -657,7 +611,7 @@ void CompileUnit::addConstantValue(DIE *Die, const MachineOperand &MO,
   // udata/sdata over dataN as suggested by the DWARF spec)
   assert(MO.isImm() && "Invalid machine operand!");
   int SizeInBits = -1;
-  bool SignedConstant = isTypeSigned(DD, Ty, &SizeInBits);
+  bool SignedConstant = isTypeSigned(Ty, &SizeInBits);
   uint16_t Form;
 
   // If we're a signed constant definitely use sdata.
@@ -827,13 +781,13 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
   DIType Ty(TyNode);
   if (!Ty.isType())
     return NULL;
-  DIE *TyDIE = DD->getTypeDIE(Ty);
+  DIE *TyDIE = getDIE(Ty);
   if (TyDIE)
     return TyDIE;
 
   // Create new type.
   TyDIE = new DIE(dwarf::DW_TAG_base_type);
-  DD->insertTypeDIE(Ty, TyDIE);
+  insertDIE(Ty, TyDIE);
   if (Ty.isBasicType())
     constructTypeDIE(*TyDIE, DIBasicType(Ty));
   else if (Ty.isCompositeType())
@@ -869,7 +823,7 @@ void CompileUnit::addType(DIE *Entity, DIType Ty, uint16_t Attribute) {
   DIEEntry *Entry = getDIEEntry(Ty);
   // If it exists then use the existing value.
   if (Entry) {
-    DD->addDIEEntry(Entity, Attribute, dwarf::DW_FORM_ref4, Entry);
+    Entity->addValue(Attribute, dwarf::DW_FORM_ref4, Entry);
     return;
   }
 
@@ -879,7 +833,7 @@ void CompileUnit::addType(DIE *Entity, DIType Ty, uint16_t Attribute) {
   // Set up proxy.
   Entry = createDIEEntry(Buffer);
   insertDIEEntry(Ty, Entry);
-  DD->addDIEEntry(Entity, Attribute, dwarf::DW_FORM_ref4, Entry);
+  Entity->addValue(Attribute, dwarf::DW_FORM_ref4, Entry);
 
   // If this is a complete composite type then include it in the
   // list of global types.
@@ -981,7 +935,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) {
   Buffer.setTag(Tag);
 
   // Map to main type, void will not have a type.
-  DIType FromTy = DD->resolve(DTy.getTypeDerivedFrom());
+  DIType FromTy = DTy.getTypeDerivedFrom();
   if (FromTy)
     addType(&Buffer, FromTy);
 
@@ -1059,7 +1013,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
         Buffer.addChild(ElemDie);
       }
     }
-    DIType DTy = DD->resolve(CTy.getTypeDerivedFrom());
+    DIType DTy = CTy.getTypeDerivedFrom();
     if (DTy) {
       addType(&Buffer, DTy);
       addUInt(&Buffer, dwarf::DW_AT_enum_class, dwarf::DW_FORM_flag, 1);
@@ -1125,8 +1079,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
         DIDerivedType DDTy(Element);
         if (DDTy.getTag() == dwarf::DW_TAG_friend) {
           ElemDie = new DIE(dwarf::DW_TAG_friend);
-          addType(ElemDie, DD->resolve(DDTy.getTypeDerivedFrom()),
-                  dwarf::DW_AT_friend);
+          addType(ElemDie, DDTy.getTypeDerivedFrom(), dwarf::DW_AT_friend);
         } else if (DDTy.isStaticMember())
           ElemDie = createStaticMemberDIE(DDTy);
         else
@@ -1267,7 +1220,7 @@ CompileUnit::getOrCreateTemplateValueParameterDIE(DITemplateValueParameter VP) {
     addString(ParamDIE, dwarf::DW_AT_name, VP.getName());
   if (Value *Val = VP.getValue()) {
     if (ConstantInt *CI = dyn_cast<ConstantInt>(Val))
-      addConstantValue(ParamDIE, CI, isUnsignedDIType(DD, VP.getType()));
+      addConstantValue(ParamDIE, CI, VP.getType().isUnsignedDIType());
     else if (GlobalValue *GV = dyn_cast<GlobalValue>(Val)) {
       // For declaration non-type template parameters (such as global values and
       // functions)
@@ -1318,14 +1271,14 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
   if (!ContextDIE)
     ContextDIE = CUDie.get();
 
-  DIE *SPDie = DD->getSPDIE(SP);
+  DIE *SPDie = getDIE(SP);
   if (SPDie)
     return SPDie;
 
   SPDie = new DIE(dwarf::DW_TAG_subprogram);
 
   // DW_TAG_inlined_subroutine may refer to this DIE.
-  DD->insertSPDIE(SP, SPDie);
+  insertDIE(SP, SPDie);
 
   DISubprogram SPDecl = SP.getFunctionDeclaration();
   DIE *DeclDie = NULL;
@@ -1472,7 +1425,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
     // But that class might not exist in the DWARF yet.
     // Creating the class will create the static member decl DIE.
     getOrCreateContextDIE(DD->resolve(SDMDecl.getContext()));
-    VariableDIE = DD->getStaticMemberDIE(SDMDecl);
+    VariableDIE = getDIE(SDMDecl);
     assert(VariableDIE && "Static member decl has no context?");
     IsStaticMember = true;
   }
@@ -1561,7 +1514,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
     // emitting AT_const_value multiple times, we only add AT_const_value when
     // it is not a static member.
     if (!IsStaticMember)
-      addConstantValue(VariableDIE, CI, isUnsignedDIType(DD, GTy));
+      addConstantValue(VariableDIE, CI, GTy.isUnsignedDIType());
   } else if (const ConstantExpr *CE = getMergedGlobalExpr(N->getOperand(11))) {
     addToAccelTable = true;
     // GV is a merged global.
@@ -1622,7 +1575,7 @@ void CompileUnit::constructArrayTypeDIE(DIE &Buffer,
     addFlag(&Buffer, dwarf::DW_AT_GNU_vector);
 
   // Emit the element type.
-  addType(&Buffer, DD->resolve(CTy->getTypeDerivedFrom()));
+  addType(&Buffer, CTy->getTypeDerivedFrom());
 
   // Get an anonymous type for index type.
   // FIXME: This type should be passed down from the front end
@@ -1666,7 +1619,7 @@ void CompileUnit::constructContainingTypeDIEs() {
     DIE *SPDie = CI->first;
     const MDNode *N = CI->second;
     if (!N) continue;
-    DIE *NDie = DD->getTypeDIE(N);
+    DIE *NDie = getDIE(N);
     if (!NDie) continue;
     addDIEEntry(SPDie, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, NDie);
   }
@@ -1729,7 +1682,7 @@ DIE *CompileUnit::constructVariableDIE(DbgVariable *DV,
       addConstantFPValue(VariableDie, DVInsn->getOperand(0));
     else if (DVInsn->getOperand(0).isCImm())
       addConstantValue(VariableDie, DVInsn->getOperand(0).getCImm(),
-                       isUnsignedDIType(DD, DV->getType()));
+                       DV->getType().isUnsignedDIType());
 
     DV->setDIE(VariableDie);
     return VariableDie;
@@ -1757,7 +1710,7 @@ DIE *CompileUnit::createMemberDIE(DIDerivedType DT) {
   if (!Name.empty())
     addString(MemberDie, dwarf::DW_AT_name, Name);
 
-  addType(MemberDie, DD->resolve(DT.getTypeDerivedFrom()));
+  addType(MemberDie, DT.getTypeDerivedFrom());
 
   addSourceLine(MemberDie, DT);
 
@@ -1765,12 +1718,11 @@ DIE *CompileUnit::createMemberDIE(DIDerivedType DT) {
   addUInt(MemLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
 
   uint64_t Size = DT.getSizeInBits();
-  uint64_t FieldSize = getOriginalTypeSize(DD, DT);
+  uint64_t FieldSize = DT.getOriginalTypeSize();
 
   if (Size != FieldSize) {
     // Handle bitfield.
-    addUInt(MemberDie, dwarf::DW_AT_byte_size, 0,
-            getOriginalTypeSize(DD, DT)>>3);
+    addUInt(MemberDie, dwarf::DW_AT_byte_size, 0, DT.getOriginalTypeSize()>>3);
     addUInt(MemberDie, dwarf::DW_AT_bit_size, 0, DT.getSizeInBits());
 
     uint64_t Offset = DT.getOffsetInBits();
@@ -1845,7 +1797,7 @@ DIE *CompileUnit::createStaticMemberDIE(const DIDerivedType DT) {
     return NULL;
 
   DIE *StaticMemberDIE = new DIE(DT.getTag());
-  DIType Ty = DD->resolve(DT.getTypeDerivedFrom());
+  DIType Ty = DT.getTypeDerivedFrom();
 
   addString(StaticMemberDIE, dwarf::DW_AT_name, DT.getName());
   addType(StaticMemberDIE, Ty);
@@ -1866,10 +1818,10 @@ DIE *CompileUnit::createStaticMemberDIE(const DIDerivedType DT) {
             dwarf::DW_ACCESS_public);
 
   if (const ConstantInt *CI = dyn_cast_or_null<ConstantInt>(DT.getConstant()))
-    addConstantValue(StaticMemberDIE, CI, isUnsignedDIType(DD, Ty));
+    addConstantValue(StaticMemberDIE, CI, Ty.isUnsignedDIType());
   if (const ConstantFP *CFP = dyn_cast_or_null<ConstantFP>(DT.getConstant()))
     addConstantFPValue(StaticMemberDIE, CFP);
 
-  DD->insertStaticMemberDIE(DT, StaticMemberDIE);
+  insertDIE(DT, StaticMemberDIE);
   return StaticMemberDIE;
 }
index c90d84b6f21ebf9924e0a7a81105c64c9e3d4c4c..3406d794180c5f3fc5b17ca2131ee9b68ba17150 100644 (file)
@@ -149,13 +149,13 @@ DIType DbgVariable::getType() const {
     uint16_t tag = Ty.getTag();
 
     if (tag == dwarf::DW_TAG_pointer_type)
-      subType = DD->resolve(DIDerivedType(Ty).getTypeDerivedFrom());
+      subType = DIDerivedType(Ty).getTypeDerivedFrom();
 
     DIArray Elements = DICompositeType(subType).getTypeArray();
     for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
       DIDerivedType DT = DIDerivedType(Elements.getElement(i));
       if (getName() == DT.getName())
-        return (DD->resolve(DT.getTypeDerivedFrom()));
+        return (DT.getTypeDerivedFrom());
     }
   }
   return Ty;
@@ -364,7 +364,7 @@ bool DwarfDebug::isSubprogramContext(const MDNode *Context) {
 // scope then create and insert DIEs for these variables.
 DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU,
                                           const MDNode *SPNode) {
-  DIE *SPDie = getSPDIE(SPNode);
+  DIE *SPDie = SPCU->getDIE(SPNode);
 
   assert(SPDie && "Unable to find subprogram DIE!");
   DISubprogram SP(SPNode);
@@ -518,7 +518,7 @@ DIE *DwarfDebug::constructInlinedScopeDIE(CompileUnit *TheCU,
     return NULL;
   DIScope DS(Scope->getScopeNode());
   DISubprogram InlinedSP = getDISubprogram(DS);
-  DIE *OriginDIE = getSPDIE(InlinedSP);
+  DIE *OriginDIE = TheCU->getDIE(InlinedSP);
   if (!OriginDIE) {
     DEBUG(dbgs() << "Unable to find original DIE for an inlined subprogram.");
     return NULL;
@@ -623,7 +623,7 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) {
   else if (DS.isSubprogram()) {
     ProcessedSPNodes.insert(DS);
     if (Scope->isAbstractScope()) {
-      ScopeDIE = getSPDIE(DS);
+      ScopeDIE = TheCU->getDIE(DS);
       // Note down abstract DIE.
       if (ScopeDIE)
         AbstractSPDies.insert(std::make_pair(DS, ScopeDIE));
@@ -993,11 +993,11 @@ void DwarfDebug::collectDeadVariables() {
         CompileUnit *SPCU = CUMap.lookup(TheCU);
         assert(SPCU && "Unable to find Compile Unit!");
         constructSubprogramDIE(SPCU, SP);
-        DIE *ScopeDIE = getSPDIE(SP);
+        DIE *ScopeDIE = SPCU->getDIE(SP);
         for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) {
           DIVariable DV(Variables.getElement(vi));
           if (!DV.isVariable()) continue;
-          DbgVariable NewVar(DV, NULL, this);
+          DbgVariable NewVar(DV, NULL);
           if (DIE *VariableDIE =
               SPCU->constructVariableDIE(&NewVar, Scope->isAbstractScope()))
             ScopeDIE->addChild(VariableDIE);
@@ -1066,15 +1066,6 @@ void DwarfDebug::finalizeModuleInfo() {
                                      Hash.computeDIEODRSignature(Die));
   }
 
-  // Process the worklist to add attributes with the correct form (ref_addr or
-  // ref4).
-  for (unsigned I = 0, E = DIEEntryWorklist.size(); I < E; I++) {
-    addDIEEntry(DIEEntryWorklist[I].Die, DIEEntryWorklist[I].Attribute,
-                dwarf::DW_FORM_ref4, DIEEntryWorklist[I].Entry);
-    assert(E == DIEEntryWorklist.size() &&
-           "We should not add to the worklist during finalization.");
-  }
-
   // Handle anything that needs to be done on a per-cu basis.
   for (DenseMap<const MDNode *, CompileUnit *>::iterator CUI = CUMap.begin(),
                                                          CUE = CUMap.end();
@@ -1265,7 +1256,7 @@ DbgVariable *DwarfDebug::findAbstractVariable(DIVariable &DV,
   if (!Scope)
     return NULL;
 
-  AbsDbgVariable = new DbgVariable(Var, NULL, this);
+  AbsDbgVariable = new DbgVariable(Var, NULL);
   addScopeVariable(Scope, AbsDbgVariable);
   AbstractVariables[Var] = AbsDbgVariable;
   return AbsDbgVariable;
@@ -1314,7 +1305,7 @@ DwarfDebug::collectVariableInfoFromMMITable(const MachineFunction *MF,
       continue;
 
     DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.second);
-    DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable, this);
+    DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable);
     RegVar->setFrameIndex(VP.first);
     if (!addCurrentFnArgument(MF, RegVar, Scope))
       addScopeVariable(Scope, RegVar);
@@ -1399,7 +1390,7 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF,
     Processed.insert(DV);
     assert(MInsn->isDebugValue() && "History must begin with debug value");
     DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc());
-    DbgVariable *RegVar = new DbgVariable(DV, AbsVar, this);
+    DbgVariable *RegVar = new DbgVariable(DV, AbsVar);
     if (!addCurrentFnArgument(MF, RegVar, Scope))
       addScopeVariable(Scope, RegVar);
     if (AbsVar)
@@ -1462,7 +1453,7 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF,
     if (!DV || !DV.isVariable() || !Processed.insert(DV))
       continue;
     if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext()))
-      addScopeVariable(Scope, new DbgVariable(DV, NULL, this));
+      addScopeVariable(Scope, new DbgVariable(DV, NULL));
   }
 }
 
@@ -1858,7 +1849,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
         if (AbstractVariables.lookup(CleanDV))
           continue;
         if (LexicalScope *Scope = LScopes.findAbstractScope(DV.getContext()))
-          addScopeVariable(Scope, new DbgVariable(DV, NULL, this));
+          addScopeVariable(Scope, new DbgVariable(DV, NULL));
       }
     }
     if (ProcessedSPNodes.count(AScope->getScopeNode()) == 0)
@@ -2064,11 +2055,7 @@ void DwarfDebug::emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs) {
       Asm->OutStreamer.AddComment(dwarf::AttributeString(Attr));
 
     switch (Attr) {
-    case dwarf::DW_AT_abstract_origin:
-    case dwarf::DW_AT_type:
-    case dwarf::DW_AT_friend:
-    case dwarf::DW_AT_specification:
-    case dwarf::DW_AT_containing_type: {
+    case dwarf::DW_AT_abstract_origin: {
       DIEEntry *E = cast<DIEEntry>(Values[i]);
       DIE *Origin = E->getEntry();
       unsigned Addr = Origin->getOffset();
@@ -3048,24 +3035,3 @@ void DwarfDebug::emitDebugStrDWO() {
   InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
                          OffSec, StrSym);
 }
-
-/// When we don't know whether the correct form is ref4 or ref_addr, we create
-/// a worklist item and insert it to DIEEntryWorklist.
-void DwarfDebug::addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form,
-                             DIEEntry *Entry) {
-  /// Early exit when we only have a single CU.
-  if (GlobalCUIndexCount == 1 || Form != dwarf::DW_FORM_ref4) {
-    Die->addValue(Attribute, Form, Entry);
-    return;
-  }
-  DIE *DieCU = Die->checkCompileUnit();
-  DIE *EntryCU = Entry->getEntry()->checkCompileUnit();
-  if (!DieCU || !EntryCU) {
-    // Die or Entry is not added to an owner yet.
-    insertDIEEntryWorklist(Die, Attribute, Entry);
-    return;
-  }
-  Die->addValue(Attribute,
-         EntryCU == DieCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr,
-         Entry);
-}
index 423ff342ec0b847dc21ef0d90f5eecc34bef8624..d45a70c52ce003c6c4ac55787a8a2ef362f113b9 100644 (file)
@@ -150,12 +150,11 @@ class DbgVariable {
   DbgVariable *AbsVar;               // Corresponding Abstract variable, if any.
   const MachineInstr *MInsn;         // DBG_VALUE instruction of the variable.
   int FrameIndex;
-  DwarfDebug *DD;
 public:
   // AbsVar may be NULL.
-  DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
+  DbgVariable(DIVariable V, DbgVariable *AV)
     : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
-      FrameIndex(~0), DD(DD) {}
+      FrameIndex(~0) {}
 
   // Accessors.
   DIVariable getVariable()           const { return Var; }
@@ -328,30 +327,6 @@ class DwarfDebug {
   // Maps subprogram MDNode with its corresponding CompileUnit.
   DenseMap <const MDNode *, CompileUnit *> SPMap;
 
-  /// Maps type MDNode with its corresponding DIE. These DIEs can be
-  /// shared across CUs, that is why we keep the map here instead
-  /// of in CompileUnit.
-  DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap;
-  /// Maps subprogram MDNode with its corresponding DIE.
-  DenseMap<const MDNode *, DIE *> MDSPNodeToDieMap;
-  /// Maps static member MDNode with its corresponding DIE.
-  DenseMap<const MDNode *, DIE *> MDStaticMemberNodeToDieMap;
-
-  /// Specifies a worklist item. Sometimes, when we try to add an attribute to
-  /// a DIE, the DIE is not yet added to its owner yet, so we don't know whether
-  /// we should use ref_addr or ref4. We create a worklist that will be
-  /// processed during finalization to add attributes with the correct form
-  /// (ref_addr or ref4).
-  struct DIEEntryWorkItem {
-    DIE *Die;
-    uint16_t Attribute;
-    DIEEntry *Entry;
-    DIEEntryWorkItem(DIE *D, uint16_t A, DIEEntry *E) :
-      Die(D), Attribute(A), Entry(E) {
-    }
-  };
-  SmallVector<DIEEntryWorkItem, 64> DIEEntryWorklist;
-
   // Used to uniquely define abbreviations.
   FoldingSet<DIEAbbrev> AbbreviationsSet;
 
@@ -686,28 +661,6 @@ public:
   DwarfDebug(AsmPrinter *A, Module *M);
   ~DwarfDebug();
 
-  void insertTypeDIE(const MDNode *TypeMD, DIE *Die) {
-    MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
-  }
-  DIE *getTypeDIE(const MDNode *TypeMD) {
-    return MDTypeNodeToDieMap.lookup(TypeMD);
-  }
-  void insertSPDIE(const MDNode *SPMD, DIE *Die) {
-    MDSPNodeToDieMap.insert(std::make_pair(SPMD, Die));
-  }
-  DIE *getSPDIE(const MDNode *SPMD) {
-    return MDSPNodeToDieMap.lookup(SPMD);
-  }
-  void insertStaticMemberDIE(const MDNode *StaticMD, DIE *Die) {
-    MDStaticMemberNodeToDieMap.insert(std::make_pair(StaticMD, Die));
-  }
-  DIE *getStaticMemberDIE(const MDNode *StaticMD) {
-    return MDStaticMemberNodeToDieMap.lookup(StaticMD);
-  }
-  void insertDIEEntryWorklist(DIE *Die, uint16_t Attribute, DIEEntry *Entry) {
-    DIEEntryWorklist.push_back(DIEEntryWorkItem(Die, Attribute, Entry));
-  }
-
   /// \brief Emit all Dwarf sections that should come prior to the
   /// content.
   void beginModule();
@@ -770,11 +723,6 @@ public:
     return Ref.resolve(TypeIdentifierMap);
   }
 
-  /// When we don't know whether the correct form is ref4 or ref_addr, we create
-  /// a worklist item and insert it to DIEEntryWorklist.
-  void addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form,
-                   DIEEntry *Entry);
-
   /// isSubprogramContext - Return true if Context is either a subprogram
   /// or another context nested inside a subprogram.
   bool isSubprogramContext(const MDNode *Context);
index b051fcc6f9bd5e8be0c51fb1ec7e5a20ac3e387a..0cd4ac6f466cb483299126528be8160bc317bc1b 100644 (file)
@@ -303,7 +303,7 @@ DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits,
     ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
     ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
     ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
-    PointeeTy.getRef()
+    PointeeTy
   };
   return DIDerivedType(MDNode::get(VMContext, Elts));
 }
index f5e7e2674fc95f5b38f6d4b33cf352c56c7314b0..42267081c95fba1282f1ff23a1f6c48b5bb47bb7 100644 (file)
@@ -368,6 +368,23 @@ void DIType::replaceAllUsesWith(MDNode *D) {
   }
 }
 
+/// isUnsignedDIType - Return true if type encoding is unsigned.
+bool DIType::isUnsignedDIType() {
+  DIDerivedType DTy(DbgNode);
+  if (DTy.Verify())
+    return DTy.getTypeDerivedFrom().isUnsignedDIType();
+
+  DIBasicType BTy(DbgNode);
+  if (BTy.Verify()) {
+    unsigned Encoding = BTy.getEncoding();
+    if (Encoding == dwarf::DW_ATE_unsigned ||
+        Encoding == dwarf::DW_ATE_unsigned_char ||
+        Encoding == dwarf::DW_ATE_boolean)
+      return true;
+  }
+  return false;
+}
+
 /// Verify - Verify that a compile unit is well formed.
 bool DICompileUnit::Verify() const {
   if (!isCompileUnit())
@@ -476,8 +493,8 @@ bool DIBasicType::Verify() const {
 
 /// Verify - Verify that a derived type descriptor is well formed.
 bool DIDerivedType::Verify() const {
-  // Make sure DerivedFrom @ field 9 is TypeRef.
-  if (!fieldIsTypeRef(DbgNode, 9))
+  // Make sure DerivedFrom @ field 9 is MDNode.
+  if (!fieldIsMDNode(DbgNode, 9))
     return false;
   if (getTag() == dwarf::DW_TAG_ptr_to_member_type)
     // Make sure ClassType @ field 10 is a TypeRef.
@@ -493,8 +510,8 @@ bool DICompositeType::Verify() const {
   if (!isCompositeType())
     return false;
 
-  // Make sure DerivedFrom @ field 9 and ContainingType @ field 12 are TypeRef.
-  if (!fieldIsTypeRef(DbgNode, 9))
+  // Make sure DerivedFrom @ field 9 and ContainingType @ field 12 are MDNodes.
+  if (!fieldIsMDNode(DbgNode, 9))
     return false;
   if (!fieldIsTypeRef(DbgNode, 12))
     return false;
@@ -503,6 +520,12 @@ bool DICompositeType::Verify() const {
   if (!fieldIsMDString(DbgNode, 14))
     return false;
 
+  // If this is an array type verify that we have a DIType in the derived type
+  // field as that's the type of our element.
+  if (getTag() == dwarf::DW_TAG_array_type)
+    if (!DIType(getTypeDerivedFrom()))
+      return false;
+
   return DbgNode->getNumOperands() == 15;
 }
 
@@ -615,6 +638,35 @@ bool DIImportedEntity::Verify() const {
          (DbgNode->getNumOperands() == 4 || DbgNode->getNumOperands() == 5);
 }
 
+/// getOriginalTypeSize - If this type is derived from a base type then
+/// return base type size.
+uint64_t DIDerivedType::getOriginalTypeSize() const {
+  uint16_t Tag = getTag();
+
+  if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
+      Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
+      Tag != dwarf::DW_TAG_restrict_type)
+    return getSizeInBits();
+
+  DIType BaseType = getTypeDerivedFrom();
+
+  // If this type is not derived from any type then take conservative approach.
+  if (!BaseType.isValid())
+    return getSizeInBits();
+
+  // If this is a derived type, go ahead and get the base type, unless it's a
+  // reference then it's just the size of the field. Pointer types have no need
+  // of this since they're a different type of qualification on the type.
+  if (BaseType.getTag() == dwarf::DW_TAG_reference_type ||
+      BaseType.getTag() == dwarf::DW_TAG_rvalue_reference_type)
+    return getSizeInBits();
+
+  if (BaseType.isDerivedType())
+    return DIDerivedType(BaseType).getOriginalTypeSize();
+
+  return BaseType.getSizeInBits();
+}
+
 /// getObjCProperty - Return property node, if this ivar is associated with one.
 MDNode *DIDerivedType::getObjCProperty() const {
   return getNodeField(DbgNode, 10);
@@ -756,19 +808,6 @@ DIScopeRef DIScope::getContext() const {
   return DIScopeRef(NULL);
 }
 
-// If the scope node has a name, return that, else return an empty string.
-StringRef DIScope::getName() const {
-  if (isType())
-    return DIType(DbgNode).getName();
-  if (isSubprogram())
-    return DISubprogram(DbgNode).getName();
-  if (isNameSpace())
-    return DINameSpace(DbgNode).getName();
-  assert((isLexicalBlock() || isLexicalBlockFile() || isFile() ||
-          isCompileUnit()) && "Unhandled type of scope.");
-  return StringRef();
-}
-
 StringRef DIScope::getFilename() const {
   if (!DbgNode)
     return StringRef();
@@ -903,14 +942,8 @@ DICompositeType llvm::getDICompositeType(DIType T) {
   if (T.isCompositeType())
     return DICompositeType(T);
 
-  if (T.isDerivedType()) {
-    // This function is currently used by dragonegg and dragonegg does
-    // not generate identifier for types, so using an empty map to resolve
-    // DerivedFrom should be fine.
-    DITypeIdentifierMap EmptyMap;
-    return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom()
-                                              .resolve(EmptyMap));
-  }
+  if (T.isDerivedType())
+    return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom());
 
   return DICompositeType();
 }
@@ -1011,7 +1044,7 @@ void DebugInfoFinder::processType(DIType DT) {
   processScope(DT.getContext().resolve(TypeIdentifierMap));
   if (DT.isCompositeType()) {
     DICompositeType DCT(DT);
-    processType(DCT.getTypeDerivedFrom().resolve(TypeIdentifierMap));
+    processType(DCT.getTypeDerivedFrom());
     DIArray DA = DCT.getTypeArray();
     for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) {
       DIDescriptor D = DA.getElement(i);
@@ -1022,7 +1055,7 @@ void DebugInfoFinder::processType(DIType DT) {
     }
   } else if (DT.isDerivedType()) {
     DIDerivedType DDT(DT);
-    processType(DDT.getTypeDerivedFrom().resolve(TypeIdentifierMap));
+    processType(DDT.getTypeDerivedFrom());
   }
 }
 
diff --git a/test/Linker/Inputs/type-unique-simple2-a.ll b/test/Linker/Inputs/type-unique-simple2-a.ll
deleted file mode 100644 (file)
index 20cfd54..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-; CHECK: 0x[[INT:.*]]: DW_TAG_base_type
-; CHECK-NEXT: DW_AT_name {{.*}} = "int"
-; CHECK-NOT: DW_TAG_base_type
-; CHECK: 0x[[BASE:.*]]: DW_TAG_structure_type
-; CHECK-NEXT: DW_AT_name {{.*}} = "Base"
-; CHECK-NOT: DW_TAG_structure_type
-; CHECK: DW_TAG_formal_parameter
-; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[INT]])
-; CHECK: DW_TAG_variable
-; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[BASE]])
-
-; LINK: DW_TAG_structure_type
-; LINK-NOT: DW_TAG_structure_type
-
-; Content of header files:
-; struct Base {
-;   int a;
-;   Base *b;
-; };
-; Content of foo.cpp:
-; 
-; #include "a.hpp"
-; void f(int a) {
-;   Base t;
-; }
-; Content of bar.cpp:
-; 
-; #include "a.hpp"
-; void f(int);
-; void g(int a) {
-;   Base t;
-; }
-; int main() {
-;   f(0);
-;   g(1);
-;   return 0;
-; }
-; ModuleID = 'foo.cpp'
-
-%struct.Base = type { i32, %struct.Base* }
-
-; Function Attrs: nounwind ssp uwtable
-define void @_Z1fi(i32 %a) #0 {
-entry:
-  %a.addr = alloca i32, align 4
-  %t = alloca %struct.Base, align 8
-  store i32 %a, i32* %a.addr, align 4
-  call void @llvm.dbg.declare(metadata !{i32* %a.addr}, metadata !17), !dbg !18
-  call void @llvm.dbg.declare(metadata !{%struct.Base* %t}, metadata !19), !dbg !20
-  ret void, !dbg !21
-}
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.declare(metadata, metadata) #1
-
-attributes #0 = { nounwind ssp 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}
-!llvm.module.flags = !{!16}
-
-!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 (http://llvm.org/git/clang.git 8a3f9e46cb988d2c664395b21910091e3730ae82) (http://llvm.org/git/llvm.git 4699e9549358bc77824a59114548eecc3f7c523c)", i1 false, metadata !"", i32 0, metadata !2, metadata !3, metadata !11, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [foo.cpp] [DW_LANG_C_plus_plus]
-!1 = metadata !{metadata !"foo.cpp", metadata !"."}
-!2 = metadata !{i32 0}
-!3 = metadata !{metadata !4}
-!4 = metadata !{i32 786451, metadata !5, null, metadata !"Base", i32 1, i64 128, i64 64, i32 0, i32 0, null, metadata !6, i32 0, null, null, metadata !"_ZTS4Base"} ; [ DW_TAG_structure_type ] [Base] [line 1, size 128, align 64, offset 0] [def] [from ]
-!5 = metadata !{metadata !"./a.hpp", metadata !"."}
-!6 = metadata !{metadata !7, metadata !9}
-!7 = metadata !{i32 786445, metadata !5, metadata !"_ZTS4Base", metadata !"a", i32 2, i64 32, i64 32, i64 0, i32 0, metadata !8} ; [ DW_TAG_member ] [a] [line 2, size 32, align 32, offset 0] [from int]
-!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
-!9 = metadata !{i32 786445, metadata !5, metadata !"_ZTS4Base", metadata !"b", i32 3, i64 64, i64 64, i64 64, i32 0, metadata !10} ; [ DW_TAG_member ] [b] [line 3, size 64, align 64, offset 64] [from ]
-!10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS4Base"}
-!11 = metadata !{metadata !12}
-!12 = metadata !{i32 786478, metadata !1, metadata !13, metadata !"f", metadata !"f", metadata !"_Z1fi", i32 3, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i32)* @_Z1fi, null, null, metadata !2, i32 3} ; [ DW_TAG_subprogram ] [line 3] [def] [f]
-!13 = metadata !{i32 786473, metadata !1}         ; [ DW_TAG_file_type ] [foo.cpp]
-!14 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
-!15 = metadata !{null, metadata !8}
-!16 = metadata !{i32 2, metadata !"Dwarf Version", i32 2}
-!17 = metadata !{i32 786689, metadata !12, metadata !"a", metadata !13, i32 16777219, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [a] [line 3]
-!18 = metadata !{i32 3, i32 0, metadata !12, null}
-!19 = metadata !{i32 786688, metadata !12, metadata !"t", metadata !13, i32 4, metadata !4, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [t] [line 4]
-!20 = metadata !{i32 4, i32 0, metadata !12, null}
-!21 = metadata !{i32 5, i32 0, metadata !12, null}
diff --git a/test/Linker/Inputs/type-unique-simple2-b.ll b/test/Linker/Inputs/type-unique-simple2-b.ll
deleted file mode 100644 (file)
index 898eb36..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-; ModuleID = 'bar.cpp'
-
-%struct.Base = type { i32, %struct.Base* }
-
-; Function Attrs: nounwind ssp uwtable
-define void @_Z1gi(i32 %a) #0 {
-entry:
-  %a.addr = alloca i32, align 4
-  %t = alloca %struct.Base, align 8
-  store i32 %a, i32* %a.addr, align 4
-  call void @llvm.dbg.declare(metadata !{i32* %a.addr}, metadata !20), !dbg !21
-  call void @llvm.dbg.declare(metadata !{%struct.Base* %t}, metadata !22), !dbg !23
-  ret void, !dbg !24
-}
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.declare(metadata, metadata) #1
-
-; Function Attrs: ssp uwtable
-define i32 @main() #2 {
-entry:
-  %retval = alloca i32, align 4
-  store i32 0, i32* %retval
-  call void @_Z1fi(i32 0), !dbg !25
-  call void @_Z1gi(i32 1), !dbg !26
-  ret i32 0, !dbg !27
-}
-
-declare void @_Z1fi(i32) #3
-
-attributes #0 = { nounwind ssp 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 }
-attributes #2 = { ssp 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 #3 = { "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" }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!19}
-
-!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 (http://llvm.org/git/clang.git 8a3f9e46cb988d2c664395b21910091e3730ae82) (http://llvm.org/git/llvm.git 4699e9549358bc77824a59114548eecc3f7c523c)", i1 false, metadata !"", i32 0, metadata !2, metadata !3, metadata !11, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [bar.cpp] [DW_LANG_C_plus_plus]
-!1 = metadata !{metadata !"bar.cpp", metadata !"."}
-!2 = metadata !{i32 0}
-!3 = metadata !{metadata !4}
-!4 = metadata !{i32 786451, metadata !5, null, metadata !"Base", i32 1, i64 128, i64 64, i32 0, i32 0, null, metadata !6, i32 0, null, null, metadata !"_ZTS4Base"} ; [ DW_TAG_structure_type ] [Base] [line 1, size 128, align 64, offset 0] [def] [from ]
-!5 = metadata !{metadata !"./a.hpp", metadata !"."}
-!6 = metadata !{metadata !7, metadata !9}
-!7 = metadata !{i32 786445, metadata !5, metadata !"_ZTS4Base", metadata !"a", i32 2, i64 32, i64 32, i64 0, i32 0, metadata !8} ; [ DW_TAG_member ] [a] [line 2, size 32, align 32, offset 0] [from int]
-!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
-!9 = metadata !{i32 786445, metadata !5, metadata !"_ZTS4Base", metadata !"b", i32 3, i64 64, i64 64, i64 64, i32 0, metadata !10} ; [ DW_TAG_member ] [b] [line 3, size 64, align 64, offset 64] [from ]
-!10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS4Base"}
-!11 = metadata !{metadata !12, metadata !16}
-!12 = metadata !{i32 786478, metadata !1, metadata !13, metadata !"g", metadata !"g", metadata !"_Z1gi", i32 4, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i32)* @_Z1gi, null, null, metadata !2, i32 4} ; [ DW_TAG_subprogram ] [line 4] [def] [g]
-!13 = metadata !{i32 786473, metadata !1}         ; [ DW_TAG_file_type ] [bar.cpp]
-!14 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
-!15 = metadata !{null, metadata !8}
-!16 = metadata !{i32 786478, metadata !1, metadata !13, metadata !"main", metadata !"main", metadata !"", i32 7, metadata !17, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, metadata !2, i32 7} ; [ DW_TAG_subprogram ] [line 7] [def] [main]
-!17 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !18, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
-!18 = metadata !{metadata !8}
-!19 = metadata !{i32 2, metadata !"Dwarf Version", i32 2}
-!20 = metadata !{i32 786689, metadata !12, metadata !"a", metadata !13, i32 16777220, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [a] [line 4]
-!21 = metadata !{i32 4, i32 0, metadata !12, null}
-!22 = metadata !{i32 786688, metadata !12, metadata !"t", metadata !13, i32 5, metadata !4, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [t] [line 5]
-!23 = metadata !{i32 5, i32 0, metadata !12, null}
-!24 = metadata !{i32 6, i32 0, metadata !12, null}
-!25 = metadata !{i32 8, i32 0, metadata !16, null} ; [ DW_TAG_imported_declaration ]
-!26 = metadata !{i32 9, i32 0, metadata !16, null}
-!27 = metadata !{i32 10, i32 0, metadata !16, null}
index 4ce768f00227ad486fa3dcef6d3c52df5e998642..c8f9462d80db477960ca95d11f581e3ac2c4ad9d 100644 (file)
@@ -1,22 +1,7 @@
-; REQUIRES: object-emission
+; RUN: llvm-link %s %p/type-unique-simple-b.ll -S -o - | FileCheck %s
 
-; RUN: llvm-link %s %p/type-unique-simple-b.ll -S -o %t
-; RUN: cat %t | FileCheck %s -check-prefix=LINK
-; RUN: llc -filetype=obj -O0 < %t > %t2
-; RUN: llvm-dwarfdump -debug-dump=info %t2 | FileCheck %s
-; CHECK: 0x[[INT:.*]]: DW_TAG_base_type
-; CHECK-NEXT: DW_AT_name {{.*}} = "int"
-; CHECK-NOT: DW_TAG_base_type
-; CHECK: 0x[[BASE:.*]]: DW_TAG_structure_type
-; CHECK-NEXT: DW_AT_name {{.*}} = "Base"
+; CHECK: DW_TAG_structure_type
 ; CHECK-NOT: DW_TAG_structure_type
-; CHECK: DW_TAG_formal_parameter
-; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[INT]])
-; CHECK: DW_TAG_variable
-; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[BASE]])
-
-; LINK: DW_TAG_structure_type
-; LINK-NOT: DW_TAG_structure_type
 ; Content of header files:
 ; struct Base {
 ;   int a;
diff --git a/test/Linker/type-unique-simple2.ll b/test/Linker/type-unique-simple2.ll
deleted file mode 100644 (file)
index ead91df..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-; REQUIRES: object-emission
-
-; RUN: llvm-link %S/Inputs/type-unique-simple2-a.ll %S/Inputs/type-unique-simple2-b.ll -S -o %t
-; RUN: cat %t | FileCheck %S/Inputs/type-unique-simple2-a.ll -check-prefix=LINK
-; RUN: llc -filetype=obj -O0 < %t > %t2
-; RUN: llvm-dwarfdump -debug-dump=info %t2 | FileCheck %S/Inputs/type-unique-simple2-a.ll
index c1300012c06ccda3859eb83dbff43764c1cd98d5..629a68e2b596e3b6041bd1af6b865c2e25a8d309 100644 (file)
@@ -38,7 +38,7 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
 !0 = metadata !{i32 589870, metadata !25, metadata !1, metadata !"idamax", metadata !"idamax", metadata !"", i32 112, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
 !1 = metadata !{i32 589865, metadata !25} ; [ DW_TAG_file_type ]
 !2 = metadata !{i32 589841, metadata !25, i32 12, metadata !"clang version 2.9 (trunk 127169)", i1 true, metadata !"", i32 0, metadata !8, metadata !8, metadata !8, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
-!3 = metadata !{i32 589845, metadata !25, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+!3 = metadata !{i32 589845, metadata !25, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
 !4 = metadata !{metadata !5}
 !5 = metadata !{i32 589860, null, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
 !6 = metadata !{i32 589870, metadata !25, metadata !1, metadata !"dscal", metadata !"dscal", metadata !"", i32 206, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]