153 changes: 130 additions & 23 deletions llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ class BitcodeReaderMetadataList {
/// move) on resize, and TrackingMDRef is very expensive to copy.
SmallVector<TrackingMDRef, 1> MetadataPtrs;

/// Structures for resolving old type refs.
struct {
SmallDenseMap<MDString *, TempMDTuple, 1> Unknown;
SmallDenseMap<MDString *, DICompositeType *, 1> Final;
SmallDenseMap<MDString *, DICompositeType *, 1> FwdDecls;
std::vector<std::pair<TrackingMDRef, TempMDTuple>> Arrays;
} OldTypeRefs;

LLVMContext &Context;
public:
BitcodeReaderMetadataList(LLVMContext &C)
Expand Down Expand Up @@ -159,6 +167,18 @@ class BitcodeReaderMetadataList {
void assignValue(Metadata *MD, unsigned Idx);
void tryToResolveCycles();
bool hasFwdRefs() const { return AnyFwdRefs; }

/// Upgrade a type that had an MDString reference.
void addTypeRef(MDString &UUID, DICompositeType &CT);

/// Upgrade a type that had an MDString reference.
Metadata *upgradeTypeRef(Metadata *MaybeUUID);

/// Upgrade a type ref array that may have MDString references.
Metadata *upgradeTypeRefArray(Metadata *MaybeTuple);

private:
Metadata *resolveTypeRefArray(Metadata *MaybeTuple);
};

class BitcodeReader : public GVMaterializer {
Expand Down Expand Up @@ -1118,14 +1138,34 @@ MDNode *BitcodeReaderMetadataList::getMDNodeFwdRefOrNull(unsigned Idx) {
}

void BitcodeReaderMetadataList::tryToResolveCycles() {
if (!AnyFwdRefs)
// Nothing to do.
return;

if (NumFwdRefs)
// Still forward references... can't resolve cycles.
return;

// Give up on finding a full definition for any forward decls that remain.
for (const auto &Ref : OldTypeRefs.FwdDecls)
OldTypeRefs.Final.insert(Ref);
OldTypeRefs.FwdDecls.clear();

// Upgrade from old type ref arrays. In strange cases, this could add to
// OldTypeRefs.Unknown.
for (const auto &Array : OldTypeRefs.Arrays)
Array.second->replaceAllUsesWith(resolveTypeRefArray(Array.first.get()));

// Replace old string-based type refs with the resolved node, if possible.
// If we haven't seen the node, leave it to the verifier to complain about
// the invalid string reference.
for (const auto &Ref : OldTypeRefs.Unknown)
if (DICompositeType *CT = OldTypeRefs.Final.lookup(Ref.first))
Ref.second->replaceAllUsesWith(CT);
else
Ref.second->replaceAllUsesWith(Ref.first);
OldTypeRefs.Unknown.clear();

if (!AnyFwdRefs)
// Nothing to do.
return;

// Resolve any cycles.
for (unsigned I = MinFwdRef, E = MaxFwdRef + 1; I != E; ++I) {
auto &MD = MetadataPtrs[I];
Expand All @@ -1141,6 +1181,60 @@ void BitcodeReaderMetadataList::tryToResolveCycles() {
AnyFwdRefs = false;
}

void BitcodeReaderMetadataList::addTypeRef(MDString &UUID,
DICompositeType &CT) {
assert(CT.getRawIdentifier() == &UUID && "Mismatched UUID");
if (CT.isForwardDecl())
OldTypeRefs.FwdDecls.insert(std::make_pair(&UUID, &CT));
else
OldTypeRefs.Final.insert(std::make_pair(&UUID, &CT));
}

Metadata *BitcodeReaderMetadataList::upgradeTypeRef(Metadata *MaybeUUID) {
auto *UUID = dyn_cast_or_null<MDString>(MaybeUUID);
if (LLVM_LIKELY(!UUID))
return MaybeUUID;

if (auto *CT = OldTypeRefs.Final.lookup(UUID))
return CT;

auto &Ref = OldTypeRefs.Unknown[UUID];
if (!Ref)
Ref = MDNode::getTemporary(Context, None);
return Ref.get();
}

Metadata *BitcodeReaderMetadataList::upgradeTypeRefArray(Metadata *MaybeTuple) {
auto *Tuple = dyn_cast_or_null<MDTuple>(MaybeTuple);
if (!Tuple || Tuple->isDistinct())
return MaybeTuple;

// Look through the array immediately if possible.
if (!Tuple->isTemporary())
return resolveTypeRefArray(Tuple);

// Create and return a placeholder to use for now. Eventually
// resolveTypeRefArrays() will be resolve this forward reference.
OldTypeRefs.Arrays.emplace_back(
std::piecewise_construct, std::make_tuple(Tuple),
std::make_tuple(MDTuple::getTemporary(Context, None)));
return OldTypeRefs.Arrays.back().second.get();
}

Metadata *BitcodeReaderMetadataList::resolveTypeRefArray(Metadata *MaybeTuple) {
auto *Tuple = dyn_cast_or_null<MDTuple>(MaybeTuple);
if (!Tuple || Tuple->isDistinct())
return MaybeTuple;

// Look through the DITypeRefArray, upgrading each DITypeRef.
SmallVector<Metadata *, 32> Ops;
Ops.reserve(Tuple->getNumOperands());
for (Metadata *MD : Tuple->operands())
Ops.push_back(upgradeTypeRef(MD));

return MDTuple::get(Context, Ops);
}

Type *BitcodeReader::getTypeByID(unsigned ID) {
// The type table size is always specified correctly.
if (ID >= TypeList.size())
Expand Down Expand Up @@ -2021,6 +2115,11 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
return cast_or_null<MDString>(getMDOrNull(ID));
};

// Support for old type refs.
auto getDITypeRefOrNull = [&](unsigned ID) {
return MetadataList.upgradeTypeRef(getMDOrNull(ID));
};

#define GET_OR_DISTINCT(CLASS, ARGS) \
(IsDistinct ? CLASS::getDistinct ARGS : CLASS::get ARGS)

Expand Down Expand Up @@ -2234,9 +2333,9 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
GET_OR_DISTINCT(DIDerivedType,
(Context, Record[1], getMDString(Record[2]),
getMDOrNull(Record[3]), Record[4],
getMDOrNull(Record[5]), getMDOrNull(Record[6]),
Record[7], Record[8], Record[9], Record[10],
getMDOrNull(Record[11]))),
getDITypeRefOrNull(Record[5]),
getDITypeRefOrNull(Record[6]), Record[7], Record[8],
Record[9], Record[10], getMDOrNull(Record[11]))),
NextMetadataNo++);
break;
}
Expand All @@ -2246,20 +2345,21 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {

// If we have a UUID and this is not a forward declaration, lookup the
// mapping.
IsDistinct = Record[0];
IsDistinct = Record[0] & 0x1;
bool IsNotUsedInTypeRef = Record[0] >= 2;
unsigned Tag = Record[1];
MDString *Name = getMDString(Record[2]);
Metadata *File = getMDOrNull(Record[3]);
unsigned Line = Record[4];
Metadata *Scope = getMDOrNull(Record[5]);
Metadata *BaseType = getMDOrNull(Record[6]);
Metadata *Scope = getDITypeRefOrNull(Record[5]);
Metadata *BaseType = getDITypeRefOrNull(Record[6]);
uint64_t SizeInBits = Record[7];
uint64_t AlignInBits = Record[8];
uint64_t OffsetInBits = Record[9];
unsigned Flags = Record[10];
Metadata *Elements = getMDOrNull(Record[11]);
unsigned RuntimeLang = Record[12];
Metadata *VTableHolder = getMDOrNull(Record[13]);
Metadata *VTableHolder = getDITypeRefOrNull(Record[13]);
Metadata *TemplateParams = getMDOrNull(Record[14]);
auto *Identifier = getMDString(Record[15]);
DICompositeType *CT = nullptr;
Expand All @@ -2276,6 +2376,8 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
SizeInBits, AlignInBits, OffsetInBits, Flags,
Elements, RuntimeLang, VTableHolder,
TemplateParams, Identifier));
if (!IsNotUsedInTypeRef && Identifier)
MetadataList.addTypeRef(*Identifier, *cast<DICompositeType>(CT));

MetadataList.assignValue(CT, NextMetadataNo++);
break;
Expand All @@ -2284,10 +2386,14 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
if (Record.size() != 3)
return error("Invalid record");

IsDistinct = Record[0];
IsDistinct = Record[0] & 0x1;
bool IsOldTypeRefArray = Record[0] < 2;
Metadata *Types = getMDOrNull(Record[2]);
if (LLVM_UNLIKELY(IsOldTypeRefArray))
Types = MetadataList.upgradeTypeRefArray(Types);

MetadataList.assignValue(
GET_OR_DISTINCT(DISubroutineType,
(Context, Record[1], getMDOrNull(Record[2]))),
GET_OR_DISTINCT(DISubroutineType, (Context, Record[1], Types)),
NextMetadataNo++);
break;
}
Expand Down Expand Up @@ -2354,10 +2460,10 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
bool HasCU = Offset && !HasFn;
DISubprogram *SP = GET_OR_DISTINCT(
DISubprogram,
(Context, getMDOrNull(Record[1]), getMDString(Record[2]),
(Context, getDITypeRefOrNull(Record[1]), getMDString(Record[2]),
getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
getMDOrNull(Record[6]), Record[7], Record[8], Record[9],
getMDOrNull(Record[10]), Record[11], Record[12], Record[13],
getDITypeRefOrNull(Record[10]), Record[11], Record[12], Record[13],
Record[14], HasCU ? CUorFn : nullptr,
getMDOrNull(Record[15 + Offset]), getMDOrNull(Record[16 + Offset]),
getMDOrNull(Record[17 + Offset])));
Expand Down Expand Up @@ -2444,7 +2550,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
IsDistinct = Record[0];
MetadataList.assignValue(GET_OR_DISTINCT(DITemplateTypeParameter,
(Context, getMDString(Record[1]),
getMDOrNull(Record[2]))),
getDITypeRefOrNull(Record[2]))),
NextMetadataNo++);
break;
}
Expand All @@ -2456,7 +2562,8 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
MetadataList.assignValue(
GET_OR_DISTINCT(DITemplateValueParameter,
(Context, Record[1], getMDString(Record[2]),
getMDOrNull(Record[3]), getMDOrNull(Record[4]))),
getDITypeRefOrNull(Record[3]),
getMDOrNull(Record[4]))),
NextMetadataNo++);
break;
}
Expand All @@ -2470,7 +2577,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
(Context, getMDOrNull(Record[1]),
getMDString(Record[2]), getMDString(Record[3]),
getMDOrNull(Record[4]), Record[5],
getMDOrNull(Record[6]), Record[7], Record[8],
getDITypeRefOrNull(Record[6]), Record[7], Record[8],
getMDOrNull(Record[9]), getMDOrNull(Record[10]))),
NextMetadataNo++);
break;
Expand All @@ -2489,8 +2596,8 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
(Context, getMDOrNull(Record[1 + HasTag]),
getMDString(Record[2 + HasTag]),
getMDOrNull(Record[3 + HasTag]), Record[4 + HasTag],
getMDOrNull(Record[5 + HasTag]), Record[6 + HasTag],
Record[7 + HasTag])),
getDITypeRefOrNull(Record[5 + HasTag]),
Record[6 + HasTag], Record[7 + HasTag])),
NextMetadataNo++);
break;
}
Expand All @@ -2515,7 +2622,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
(Context, getMDString(Record[1]),
getMDOrNull(Record[2]), Record[3],
getMDString(Record[4]), getMDString(Record[5]),
Record[6], getMDOrNull(Record[7]))),
Record[6], getDITypeRefOrNull(Record[7]))),
NextMetadataNo++);
break;
}
Expand All @@ -2527,7 +2634,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
MetadataList.assignValue(
GET_OR_DISTINCT(DIImportedEntity,
(Context, Record[1], getMDOrNull(Record[2]),
getMDOrNull(Record[3]), Record[4],
getDITypeRefOrNull(Record[3]), Record[4],
getMDString(Record[5]))),
NextMetadataNo++);
break;
Expand Down
6 changes: 4 additions & 2 deletions llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,8 @@ void ModuleBitcodeWriter::writeDIDerivedType(const DIDerivedType *N,
void ModuleBitcodeWriter::writeDICompositeType(
const DICompositeType *N, SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
Record.push_back(N->isDistinct());
const unsigned IsNotUsedInOldTypeRef = 0x2;
Record.push_back(IsNotUsedInOldTypeRef | N->isDistinct());
Record.push_back(N->getTag());
Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
Record.push_back(VE.getMetadataOrNullID(N->getFile()));
Expand All @@ -1297,7 +1298,8 @@ void ModuleBitcodeWriter::writeDICompositeType(
void ModuleBitcodeWriter::writeDISubroutineType(
const DISubroutineType *N, SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
Record.push_back(N->isDistinct());
const unsigned HasNoOldTypeRefs = 0x2;
Record.push_back(HasNoOldTypeRefs | N->isDistinct());
Record.push_back(N->getFlags());
Record.push_back(VE.getMetadataOrNullID(N->getTypeArray().get()));

Expand Down
24 changes: 7 additions & 17 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,13 @@ bool DebugLocDwarfExpression::isFrameRegister(unsigned MachineReg) {

//===----------------------------------------------------------------------===//

/// resolve - Look in the DwarfDebug map for the MDNode that
/// corresponds to the reference.
template <typename T> T *DbgVariable::resolve(TypedDINodeRef<T> Ref) const {
return DD->resolve(Ref);
}

bool DbgVariable::isBlockByrefVariable() const {
assert(Var && "Invalid complex DbgVariable!");
return Var->getType()
.resolve(DD->getTypeIdentifierMap())
->isBlockByrefStruct();
return Var->getType().resolve()->isBlockByrefStruct();
}

const DIType *DbgVariable::getType() const {
DIType *Ty = Var->getType().resolve(DD->getTypeIdentifierMap());
DIType *Ty = Var->getType().resolve();
// FIXME: isBlockByrefVariable should be reformulated in terms of complex
// addresses instead.
if (Ty->isBlockByrefStruct()) {
Expand Down Expand Up @@ -474,7 +466,6 @@ void DwarfDebug::beginModule() {

const Module *M = MMI->getModule();

TypeIdentifierMap = generateDITypeIdentifierMap(*M);
unsigned NumDebugCUs = 0;
for (DICompileUnit *CUNode : M->debug_compile_units()) {
(void)CUNode;
Expand All @@ -494,12 +485,12 @@ void DwarfDebug::beginModule() {
for (auto *Ty : CUNode->getEnumTypes()) {
// The enum types array by design contains pointers to
// MDNodes rather than DIRefs. Unique them here.
CU.getOrCreateTypeDIE(cast<DIType>(resolve(Ty->getRef())));
CU.getOrCreateTypeDIE(cast<DIType>(Ty));
}
for (auto *Ty : CUNode->getRetainedTypes()) {
// The retained types array by design contains pointers to
// MDNodes rather than DIRefs. Unique them here.
if (DIType *RT = dyn_cast<DIType>(resolve(Ty->getRef())))
if (DIType *RT = dyn_cast<DIType>(Ty))
if (!RT->isExternalTypeRef())
// There is no point in force-emitting a forward declaration.
CU.getOrCreateTypeDIE(RT);
Expand Down Expand Up @@ -705,7 +696,7 @@ DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV) {

void DwarfDebug::createAbstractVariable(const DILocalVariable *Var,
LexicalScope *Scope) {
auto AbsDbgVariable = make_unique<DbgVariable>(Var, /* IA */ nullptr, this);
auto AbsDbgVariable = make_unique<DbgVariable>(Var, /* IA */ nullptr);
InfoHolder.addScopeVariable(Scope, AbsDbgVariable.get());
AbstractVariables[Var] = std::move(AbsDbgVariable);
}
Expand Down Expand Up @@ -749,7 +740,7 @@ void DwarfDebug::collectVariableInfoFromMMITable(
continue;

ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode());
auto RegVar = make_unique<DbgVariable>(Var.first, Var.second, this);
auto RegVar = make_unique<DbgVariable>(Var.first, Var.second);
RegVar->initializeMMI(VI.Expr, VI.Slot);
if (InfoHolder.addScopeVariable(Scope, RegVar.get()))
ConcreteVariables.push_back(std::move(RegVar));
Expand Down Expand Up @@ -923,8 +914,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
DbgVariable *DwarfDebug::createConcreteVariable(LexicalScope &Scope,
InlinedVariable IV) {
ensureAbstractVariableIsCreatedIfScoped(IV, Scope.getScopeNode());
ConcreteVariables.push_back(
make_unique<DbgVariable>(IV.first, IV.second, this));
ConcreteVariables.push_back(make_unique<DbgVariable>(IV.first, IV.second));
InfoHolder.addScopeVariable(&Scope, ConcreteVariables.back().get());
return ConcreteVariables.back().get();
}
Expand Down
21 changes: 6 additions & 15 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@ class DbgVariable {
unsigned DebugLocListIndex = ~0u; /// Offset in DebugLocs.
const MachineInstr *MInsn = nullptr; /// DBG_VALUE instruction.
SmallVector<int, 1> FrameIndex; /// Frame index.
DwarfDebug *DD;

public:
/// Construct a DbgVariable.
///
/// Creates a variable without any DW_AT_location. Call \a initializeMMI()
/// for MMI entries, or \a initializeDbgValue() for DBG_VALUE instructions.
DbgVariable(const DILocalVariable *V, const DILocation *IA, DwarfDebug *DD)
: Var(V), IA(IA), DD(DD) {}
DbgVariable(const DILocalVariable *V, const DILocation *IA)
: Var(V), IA(IA) {}

/// Initialize from the MMI table.
void initializeMMI(const DIExpression *E, int FI) {
Expand Down Expand Up @@ -177,9 +176,9 @@ class DbgVariable {
const DIType *getType() const;

private:
/// Look in the DwarfDebug map for the MDNode that
/// corresponds to the reference.
template <typename T> T *resolve(TypedDINodeRef<T> Ref) const;
template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
return Ref.resolve();
}
};


Expand Down Expand Up @@ -255,9 +254,6 @@ class DwarfDebug : public DebugHandlerBase {
/// Version of dwarf we're emitting.
unsigned DwarfVersion;

/// Maps from a type identifier to the actual MDNode.
DITypeIdentifierMap TypeIdentifierMap;

/// DWARF5 Experimental Options
/// @{
bool HasDwarfAccelTables;
Expand Down Expand Up @@ -525,12 +521,7 @@ class DwarfDebug : public DebugHandlerBase {

/// Find the MDNode for the given reference.
template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
return Ref.resolve(TypeIdentifierMap);
}

/// Return the TypeIdentifierMap.
const DITypeIdentifierMap &getTypeIdentifierMap() const {
return TypeIdentifierMap;
return Ref.resolve();
}

/// Find the DwarfCompileUnit for the given CU Die.
Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,6 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
return nullptr;

auto *Ty = cast<DIType>(TyNode);
assert(Ty == resolve(Ty->getRef()) &&
"type was not uniqued, possible ODR violation.");

// DW_TAG_restrict_type is not supported in DWARF2
if (Ty->getTag() == dwarf::DW_TAG_restrict_type && DD->getDwarfVersion() <= 2)
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class DwarfUnit {
/// Look in the DwarfDebug map for the MDNode that corresponds to the
/// reference.
template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
return DD->resolve(Ref);
return Ref.resolve();
}

private:
Expand Down
174 changes: 71 additions & 103 deletions llvm/lib/IR/DIBuilder.cpp

Large diffs are not rendered by default.

59 changes: 11 additions & 48 deletions llvm/lib/IR/DebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,6 @@ DISubprogram *llvm::getDISubprogram(const MDNode *Scope) {
return nullptr;
}

DITypeIdentifierMap
llvm::generateDITypeIdentifierMap(const Module &M) {
DITypeIdentifierMap Map;
for (DICompileUnit *CU : M.debug_compile_units()) {
DINodeArray Retain = CU->getRetainedTypes();
for (unsigned Ti = 0, Te = Retain.size(); Ti != Te; ++Ti) {
if (!isa<DICompositeType>(Retain[Ti]))
continue;
auto *Ty = cast<DICompositeType>(Retain[Ti]);
if (MDString *TypeId = Ty->getRawIdentifier()) {
// Definition has priority over declaration.
// Try to insert (TypeId, Ty) to Map.
std::pair<DITypeIdentifierMap::iterator, bool> P =
Map.insert(std::make_pair(TypeId, Ty));
// If TypeId already exists in Map and this is a definition, replace
// whatever we had (declaration or definition) with the definition.
if (!P.second && !Ty->isForwardDecl())
P.first->second = Ty;
}
}
}
return Map;
}

//===----------------------------------------------------------------------===//
// DebugInfoFinder implementations.
//===----------------------------------------------------------------------===//
Expand All @@ -72,25 +48,15 @@ void DebugInfoFinder::reset() {
TYs.clear();
Scopes.clear();
NodesSeen.clear();
TypeIdentifierMap.clear();
TypeMapInitialized = false;
}

void DebugInfoFinder::InitializeTypeMap(const Module &M) {
if (TypeMapInitialized)
return;
TypeIdentifierMap = generateDITypeIdentifierMap(M);
TypeMapInitialized = true;
}

void DebugInfoFinder::processModule(const Module &M) {
InitializeTypeMap(M);
for (auto *CU : M.debug_compile_units()) {
addCompileUnit(CU);
for (auto *DIG : CU->getGlobalVariables()) {
if (addGlobalVariable(DIG)) {
processScope(DIG->getScope());
processType(DIG->getType().resolve(TypeIdentifierMap));
processType(DIG->getType().resolve());
}
}
for (auto *ET : CU->getEnumTypes())
Expand All @@ -101,7 +67,7 @@ void DebugInfoFinder::processModule(const Module &M) {
else
processSubprogram(cast<DISubprogram>(RT));
for (auto *Import : CU->getImportedEntities()) {
auto *Entity = Import->getEntity().resolve(TypeIdentifierMap);
auto *Entity = Import->getEntity().resolve();
if (auto *T = dyn_cast<DIType>(Entity))
processType(T);
else if (auto *SP = dyn_cast<DISubprogram>(Entity))
Expand All @@ -120,22 +86,21 @@ void DebugInfoFinder::processModule(const Module &M) {
void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
if (!Loc)
return;
InitializeTypeMap(M);
processScope(Loc->getScope());
processLocation(M, Loc->getInlinedAt());
}

void DebugInfoFinder::processType(DIType *DT) {
if (!addType(DT))
return;
processScope(DT->getScope().resolve(TypeIdentifierMap));
processScope(DT->getScope().resolve());
if (auto *ST = dyn_cast<DISubroutineType>(DT)) {
for (DITypeRef Ref : ST->getTypeArray())
processType(Ref.resolve(TypeIdentifierMap));
processType(Ref.resolve());
return;
}
if (auto *DCT = dyn_cast<DICompositeType>(DT)) {
processType(DCT->getBaseType().resolve(TypeIdentifierMap));
processType(DCT->getBaseType().resolve());
for (Metadata *D : DCT->getElements()) {
if (auto *T = dyn_cast<DIType>(D))
processType(T);
Expand All @@ -145,7 +110,7 @@ void DebugInfoFinder::processType(DIType *DT) {
return;
}
if (auto *DDT = dyn_cast<DIDerivedType>(DT)) {
processType(DDT->getBaseType().resolve(TypeIdentifierMap));
processType(DDT->getBaseType().resolve());
}
}

Expand Down Expand Up @@ -178,13 +143,13 @@ void DebugInfoFinder::processScope(DIScope *Scope) {
void DebugInfoFinder::processSubprogram(DISubprogram *SP) {
if (!addSubprogram(SP))
return;
processScope(SP->getScope().resolve(TypeIdentifierMap));
processScope(SP->getScope().resolve());
processType(SP->getType());
for (auto *Element : SP->getTemplateParams()) {
if (auto *TType = dyn_cast<DITemplateTypeParameter>(Element)) {
processType(TType->getType().resolve(TypeIdentifierMap));
processType(TType->getType().resolve());
} else if (auto *TVal = dyn_cast<DITemplateValueParameter>(Element)) {
processType(TVal->getType().resolve(TypeIdentifierMap));
processType(TVal->getType().resolve());
}
}
}
Expand All @@ -194,7 +159,6 @@ void DebugInfoFinder::processDeclare(const Module &M,
auto *N = dyn_cast<MDNode>(DDI->getVariable());
if (!N)
return;
InitializeTypeMap(M);

auto *DV = dyn_cast<DILocalVariable>(N);
if (!DV)
Expand All @@ -203,14 +167,13 @@ void DebugInfoFinder::processDeclare(const Module &M,
if (!NodesSeen.insert(DV).second)
return;
processScope(DV->getScope());
processType(DV->getType().resolve(TypeIdentifierMap));
processType(DV->getType().resolve());
}

void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
auto *N = dyn_cast<MDNode>(DVI->getVariable());
if (!N)
return;
InitializeTypeMap(M);

auto *DV = dyn_cast<DILocalVariable>(N);
if (!DV)
Expand All @@ -219,7 +182,7 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
if (!NodesSeen.insert(DV).second)
return;
processScope(DV->getScope());
processType(DV->getType().resolve(TypeIdentifierMap));
processType(DV->getType().resolve());
}

bool DebugInfoFinder::addType(DIType *DT) {
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/IR/DebugInfoMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ DIScopeRef DIScope::getScope() const {
return SP->getScope();

if (auto *LB = dyn_cast<DILexicalBlockBase>(this))
return DIScopeRef(LB->getScope());
return LB->getScope();

if (auto *NS = dyn_cast<DINamespace>(this))
return DIScopeRef(NS->getScope());
return NS->getScope();

if (auto *M = dyn_cast<DIModule>(this))
return DIScopeRef(M->getScope());
return M->getScope();

assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
"Unhandled type of scope.");
Expand Down
25 changes: 18 additions & 7 deletions llvm/lib/IR/LLVMContextImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,10 @@ template <> struct MDNodeKeyImpl<DIDerivedType> {
// If this is a member inside an ODR type, only hash the type and the name.
// Otherwise the hash will be stronger than
// MDNodeSubsetEqualImpl::isODRMember().
if (Tag == dwarf::DW_TAG_member && Name && Scope && isa<MDString>(Scope))
return hash_combine(Name, Scope);
if (Tag == dwarf::DW_TAG_member && Name)
if (auto *CT = dyn_cast_or_null<DICompositeType>(Scope))
if (CT->getRawIdentifier())
return hash_combine(Name, Scope);

// Intentionally computes the hash on a subset of the operands for
// performance reason. The subset has to be significant enough to avoid
Expand All @@ -406,7 +408,11 @@ template <> struct MDNodeSubsetEqualImpl<DIDerivedType> {
static bool isODRMember(unsigned Tag, const Metadata *Scope,
const MDString *Name, const DIDerivedType *RHS) {
// Check whether the LHS is eligible.
if (Tag != dwarf::DW_TAG_member || !Name || !Scope || !isa<MDString>(Scope))
if (Tag != dwarf::DW_TAG_member || !Name)
return false;

auto *CT = dyn_cast_or_null<DICompositeType>(Scope);
if (!CT || !CT->getRawIdentifier())
return false;

// Compare to the RHS.
Expand Down Expand Up @@ -571,8 +577,10 @@ template <> struct MDNodeKeyImpl<DISubprogram> {
// If this is a declaration inside an ODR type, only hash the type and the
// name. Otherwise the hash will be stronger than
// MDNodeSubsetEqualImpl::isDeclarationOfODRMember().
if (!IsDefinition && LinkageName && Scope && isa<MDString>(Scope))
return hash_combine(LinkageName, Scope);
if (!IsDefinition && LinkageName)
if (auto *CT = dyn_cast_or_null<DICompositeType>(Scope))
if (CT->getRawIdentifier())
return hash_combine(LinkageName, Scope);

// Intentionally computes the hash on a subset of the operands for
// performance reason. The subset has to be significant enough to avoid
Expand All @@ -599,8 +607,11 @@ template <> struct MDNodeSubsetEqualImpl<DISubprogram> {
const MDString *LinkageName,
const DISubprogram *RHS) {
// Check whether the LHS is eligible.
if (IsDefinition || !Scope || !LinkageName || !Scope ||
!isa<MDString>(Scope))
if (IsDefinition || !Scope || !LinkageName)
return false;

auto *CT = dyn_cast_or_null<DICompositeType>(Scope);
if (!CT || !CT->getRawIdentifier())
return false;

// Compare to the RHS.
Expand Down
172 changes: 28 additions & 144 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
/// Track all DICompileUnits visited.
SmallPtrSet<const Metadata *, 2> CUVisited;

/// \brief Track unresolved string-based type references.
SmallDenseMap<const MDString *, const MDNode *, 32> UnresolvedTypeRefs;

/// \brief The result type for a landingpad.
Type *LandingPadResultTy;

Expand Down Expand Up @@ -323,9 +320,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {

verifyCompileUnits();

// Verify type references last.
verifyTypeRefs();

return !Broken;
}

Expand Down Expand Up @@ -362,27 +356,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {

void visitTemplateParams(const MDNode &N, const Metadata &RawParams);

/// \brief Check for a valid string-based type reference.
///
/// Checks if \c MD is a string-based type reference. If it is, keeps track
/// of it (and its user, \c N) for error messages later.
bool isValidUUID(const MDNode &N, const Metadata *MD);

/// \brief Check for a valid type reference.
///
/// Checks for subclasses of \a DIType, or \a isValidUUID().
bool isTypeRef(const MDNode &N, const Metadata *MD);

/// \brief Check for a valid scope reference.
///
/// Checks for subclasses of \a DIScope, or \a isValidUUID().
bool isScopeRef(const MDNode &N, const Metadata *MD);

/// \brief Check for a valid debug info reference.
///
/// Checks for subclasses of \a DINode, or \a isValidUUID().
bool isDIRef(const MDNode &N, const Metadata *MD);

// InstVisitor overrides...
using InstVisitor<Verifier>::visit;
void visit(Instruction &I);
Expand Down Expand Up @@ -467,15 +440,10 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
void verifyFrameRecoverIndices();
void verifySiblingFuncletUnwinds();

/// @{
void verifyBitPieceExpression(const DbgInfoIntrinsic &I);

/// Module-level debug info verification...
void verifyTypeRefs();
void verifyCompileUnits();
template <class MapTy>
void verifyBitPieceExpression(const DbgInfoIntrinsic &I,
const MapTy &TypeRefs);
void visitUnresolvedTypeRef(const MDString *S, const MDNode *N);
/// @}
};
} // End anonymous namespace

Expand Down Expand Up @@ -774,31 +742,9 @@ void Verifier::visitMetadataAsValue(const MetadataAsValue &MDV, Function *F) {
visitValueAsMetadata(*V, F);
}

bool Verifier::isValidUUID(const MDNode &N, const Metadata *MD) {
auto *S = dyn_cast<MDString>(MD);
if (!S || S->getString().empty())
return false;

// Keep track of names of types referenced via UUID so we can check that they
// actually exist.
UnresolvedTypeRefs.insert(std::make_pair(S, &N));
return true;
}

/// \brief Check if a value can be a reference to a type.
bool Verifier::isTypeRef(const MDNode &N, const Metadata *MD) {
return !MD || isValidUUID(N, MD) || isa<DIType>(MD);
}

/// \brief Check if a value can be a ScopeRef.
bool Verifier::isScopeRef(const MDNode &N, const Metadata *MD) {
return !MD || isValidUUID(N, MD) || isa<DIScope>(MD);
}

/// \brief Check if a value can be a debug info ref.
bool Verifier::isDIRef(const MDNode &N, const Metadata *MD) {
return !MD || isValidUUID(N, MD) || isa<DINode>(MD);
}
static bool isType(const Metadata *MD) { return !MD || isa<DIType>(MD); }
static bool isScope(const Metadata *MD) { return !MD || isa<DIScope>(MD); }
static bool isDINode(const Metadata *MD) { return !MD || isa<DINode>(MD); }

template <class Ty>
bool isValidMetadataArrayImpl(const MDTuple &N, bool AllowNull) {
Expand Down Expand Up @@ -872,13 +818,13 @@ void Verifier::visitDIDerivedType(const DIDerivedType &N) {
N.getTag() == dwarf::DW_TAG_friend,
"invalid tag", &N);
if (N.getTag() == dwarf::DW_TAG_ptr_to_member_type) {
Assert(isTypeRef(N, N.getExtraData()), "invalid pointer to member type", &N,
N.getExtraData());
Assert(isType(N.getRawExtraData()), "invalid pointer to member type", &N,
N.getRawExtraData());
}

Assert(isScopeRef(N, N.getScope()), "invalid scope", &N, N.getRawScope());
Assert(isTypeRef(N, N.getBaseType()), "invalid base type", &N,
N.getBaseType());
Assert(isScope(N.getRawScope()), "invalid scope", &N, N.getRawScope());
Assert(isType(N.getRawBaseType()), "invalid base type", &N,
N.getRawBaseType());
}

static bool hasConflictingReferenceFlags(unsigned Flags) {
Expand Down Expand Up @@ -906,13 +852,13 @@ void Verifier::visitDICompositeType(const DICompositeType &N) {
N.getTag() == dwarf::DW_TAG_class_type,
"invalid tag", &N);

Assert(isScopeRef(N, N.getScope()), "invalid scope", &N, N.getRawScope());
Assert(isTypeRef(N, N.getBaseType()), "invalid base type", &N,
N.getBaseType());
Assert(isScope(N.getRawScope()), "invalid scope", &N, N.getRawScope());
Assert(isType(N.getRawBaseType()), "invalid base type", &N,
N.getRawBaseType());

Assert(!N.getRawElements() || isa<MDTuple>(N.getRawElements()),
"invalid composite elements", &N, N.getRawElements());
Assert(isTypeRef(N, N.getRawVTableHolder()), "invalid vtable holder", &N,
Assert(isType(N.getRawVTableHolder()), "invalid vtable holder", &N,
N.getRawVTableHolder());
Assert(!hasConflictingReferenceFlags(N.getFlags()), "invalid reference flags",
&N);
Expand All @@ -931,7 +877,7 @@ void Verifier::visitDISubroutineType(const DISubroutineType &N) {
if (auto *Types = N.getRawTypeArray()) {
Assert(isa<MDTuple>(Types), "invalid composite elements", &N, Types);
for (Metadata *Ty : N.getTypeArray()->operands()) {
Assert(isTypeRef(N, Ty), "invalid subroutine type ref", &N, Types, Ty);
Assert(isType(Ty), "invalid subroutine type ref", &N, Types, Ty);
}
}
Assert(!hasConflictingReferenceFlags(N.getFlags()), "invalid reference flags",
Expand Down Expand Up @@ -998,12 +944,12 @@ void Verifier::visitDICompileUnit(const DICompileUnit &N) {

void Verifier::visitDISubprogram(const DISubprogram &N) {
Assert(N.getTag() == dwarf::DW_TAG_subprogram, "invalid tag", &N);
Assert(isScopeRef(N, N.getRawScope()), "invalid scope", &N, N.getRawScope());
Assert(isScope(N.getRawScope()), "invalid scope", &N, N.getRawScope());
if (auto *F = N.getRawFile())
Assert(isa<DIFile>(F), "invalid file", &N, F);
if (auto *T = N.getRawType())
Assert(isa<DISubroutineType>(T), "invalid subroutine type", &N, T);
Assert(isTypeRef(N, N.getRawContainingType()), "invalid containing type", &N,
Assert(isType(N.getRawContainingType()), "invalid containing type", &N,
N.getRawContainingType());
if (auto *Params = N.getRawTemplateParams())
visitTemplateParams(N, *Params);
Expand Down Expand Up @@ -1086,7 +1032,7 @@ void Verifier::visitDIModule(const DIModule &N) {
}

void Verifier::visitDITemplateParameter(const DITemplateParameter &N) {
Assert(isTypeRef(N, N.getType()), "invalid type ref", &N, N.getType());
Assert(isType(N.getRawType()), "invalid type ref", &N, N.getRawType());
}

void Verifier::visitDITemplateTypeParameter(const DITemplateTypeParameter &N) {
Expand All @@ -1109,7 +1055,7 @@ void Verifier::visitDITemplateValueParameter(
void Verifier::visitDIVariable(const DIVariable &N) {
if (auto *S = N.getRawScope())
Assert(isa<DIScope>(S), "invalid scope", &N, S);
Assert(isTypeRef(N, N.getRawType()), "invalid type ref", &N, N.getRawType());
Assert(isType(N.getRawType()), "invalid type ref", &N, N.getRawType());
if (auto *F = N.getRawFile())
Assert(isa<DIFile>(F), "invalid file", &N, F);
}
Expand Down Expand Up @@ -1148,7 +1094,7 @@ void Verifier::visitDIExpression(const DIExpression &N) {
void Verifier::visitDIObjCProperty(const DIObjCProperty &N) {
Assert(N.getTag() == dwarf::DW_TAG_APPLE_property, "invalid tag", &N);
if (auto *T = N.getRawType())
Assert(isTypeRef(N, T), "invalid type ref", &N, T);
Assert(isType(T), "invalid type ref", &N, T);
if (auto *F = N.getRawFile())
Assert(isa<DIFile>(F), "invalid file", &N, F);
}
Expand All @@ -1159,8 +1105,8 @@ void Verifier::visitDIImportedEntity(const DIImportedEntity &N) {
"invalid tag", &N);
if (auto *S = N.getRawScope())
Assert(isa<DIScope>(S), "invalid scope for imported entity", &N, S);
Assert(isDIRef(N, N.getEntity()), "invalid imported entity", &N,
N.getEntity());
Assert(isDINode(N.getRawEntity()), "invalid imported entity", &N,
N.getRawEntity());
}

void Verifier::visitComdat(const Comdat &C) {
Expand Down Expand Up @@ -3725,6 +3671,9 @@ void Verifier::visitInstruction(Instruction &I) {
visitMDNode(*N);
}

if (auto *DII = dyn_cast<DbgInfoIntrinsic>(&I))
verifyBitPieceExpression(*DII);

InstsInThisBlock.insert(&I);
}

Expand Down Expand Up @@ -4335,8 +4284,7 @@ void Verifier::visitDbgIntrinsic(StringRef Kind, DbgIntrinsicTy &DII) {
Loc->getScope()->getSubprogram());
}

template <class MapTy>
static uint64_t getVariableSize(const DILocalVariable &V, const MapTy &Map) {
static uint64_t getVariableSize(const DILocalVariable &V) {
// Be careful of broken types (checked elsewhere).
const Metadata *RawType = V.getRawType();
while (RawType) {
Expand All @@ -4351,12 +4299,6 @@ static uint64_t getVariableSize(const DILocalVariable &V, const MapTy &Map) {
continue;
}

if (auto *S = dyn_cast<MDString>(RawType)) {
// Don't error on missing types (checked elsewhere).
RawType = Map.lookup(S);
continue;
}

// Missing type or size.
break;
}
Expand All @@ -4365,9 +4307,7 @@ static uint64_t getVariableSize(const DILocalVariable &V, const MapTy &Map) {
return 0;
}

template <class MapTy>
void Verifier::verifyBitPieceExpression(const DbgInfoIntrinsic &I,
const MapTy &TypeRefs) {
void Verifier::verifyBitPieceExpression(const DbgInfoIntrinsic &I) {
DILocalVariable *V;
DIExpression *E;
if (auto *DVI = dyn_cast<DbgValueInst>(&I)) {
Expand Down Expand Up @@ -4398,7 +4338,7 @@ void Verifier::verifyBitPieceExpression(const DbgInfoIntrinsic &I,

// If there's no size, the type is broken, but that should be checked
// elsewhere.
uint64_t VarSize = getVariableSize(*V, TypeRefs);
uint64_t VarSize = getVariableSize(*V);
if (!VarSize)
return;

Expand All @@ -4409,12 +4349,6 @@ void Verifier::verifyBitPieceExpression(const DbgInfoIntrinsic &I,
Assert(PieceSize != VarSize, "piece covers entire variable", &I, V, E);
}

void Verifier::visitUnresolvedTypeRef(const MDString *S, const MDNode *N) {
// This is in its own function so we get an error for each bad type ref (not
// just the first).
Assert(false, "unresolved type ref", S, N);
}

void Verifier::verifyCompileUnits() {
auto *CUs = M->getNamedMetadata("llvm.dbg.cu");
SmallPtrSet<const Metadata *, 2> Listed;
Expand All @@ -4427,56 +4361,6 @@ void Verifier::verifyCompileUnits() {
CUVisited.clear();
}

void Verifier::verifyTypeRefs() {
auto *CUs = M->getNamedMetadata("llvm.dbg.cu");
if (!CUs)
return;

// Visit all the compile units again to map the type references.
SmallDenseMap<const MDString *, const DIType *, 32> TypeRefs;
for (auto *MD : CUs->operands()) {
auto *CU = dyn_cast<DICompileUnit>(MD);
if (!CU)
continue;
auto *Array = CU->getRawRetainedTypes();
if (!Array || !isa<MDTuple>(Array))
continue;
for (DIScope *Op : CU->getRetainedTypes())
if (auto *T = dyn_cast_or_null<DICompositeType>(Op))
if (auto *S = T->getRawIdentifier()) {
UnresolvedTypeRefs.erase(S);
TypeRefs.insert(std::make_pair(S, T));
}
}

// Verify debug info intrinsic bit piece expressions. This needs a second
// pass through the intructions, since we haven't built TypeRefs yet when
// verifying functions, and simply queuing the DbgInfoIntrinsics to evaluate
// later/now would queue up some that could be later deleted.
for (const Function &F : *M)
for (const BasicBlock &BB : F)
for (const Instruction &I : BB)
if (auto *DII = dyn_cast<DbgInfoIntrinsic>(&I))
verifyBitPieceExpression(*DII, TypeRefs);

// Return early if all typerefs were resolved.
if (UnresolvedTypeRefs.empty())
return;

// Sort the unresolved references by name so the output is deterministic.
typedef std::pair<const MDString *, const MDNode *> TypeRef;
SmallVector<TypeRef, 32> Unresolved(UnresolvedTypeRefs.begin(),
UnresolvedTypeRefs.end());
std::sort(Unresolved.begin(), Unresolved.end(),
[](const TypeRef &LHS, const TypeRef &RHS) {
return LHS.first->getString() < RHS.first->getString();
});

// Visit the unresolved refs (printing out the errors).
for (const TypeRef &TR : Unresolved)
visitUnresolvedTypeRef(TR.first, TR.second);
}

//===----------------------------------------------------------------------===//
// Implement the public interfaces to this file...
//===----------------------------------------------------------------------===//
Expand Down
20 changes: 10 additions & 10 deletions llvm/test/Assembler/dicompositetype-members.ll
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

; Define an identified type with fields and functions.
; CHECK-NEXT: !3 = !DICompositeType(tag: DW_TAG_structure_type, name: "has-uuid",{{.*}}, identifier: "uuid")
; CHECK-NEXT: !4 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !"uuid", file: !1
; CHECK-NEXT: !5 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !"uuid", file: !1
; CHECK-NEXT: !6 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !"uuid", file: !1
; CHECK-NEXT: !7 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !"uuid", file: !1
; CHECK-NEXT: !4 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !3, file: !1
; CHECK-NEXT: !5 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !3, file: !1
; CHECK-NEXT: !6 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !3, file: !1
; CHECK-NEXT: !7 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !3, file: !1
!3 = !DICompositeType(tag: DW_TAG_structure_type, name: "has-uuid", file: !1, line: 2, size: 64, align: 32, identifier: "uuid")
!4 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !"uuid", file: !1, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
!5 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !"uuid", file: !1, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
!6 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !"uuid", file: !1, isDefinition: false)
!7 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !"uuid", file: !1, isDefinition: false)
!4 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !3, file: !1, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
!5 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !3, file: !1, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
!6 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !3, file: !1, isDefinition: false)
!7 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !3, file: !1, isDefinition: false)

; Define an un-identified type with fields and functions.
; CHECK-NEXT: !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "no-uuid", file: !1
Expand All @@ -45,8 +45,8 @@

; Add duplicate fields and members of "has-uuid" in a different file. These
; should be merged.
!15 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !"uuid", file: !2, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
!16 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !"uuid", file: !2, isDefinition: false)
!15 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !3, file: !2, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
!16 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !3, file: !2, isDefinition: false)

; CHECK-NEXT: !15 = !{!4, !6}
; CHECK-NOT: !DIDerivedType
Expand Down
35 changes: 35 additions & 0 deletions llvm/test/Bitcode/dityperefs-3.8.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
; RUN: llvm-dis < %s.bc | FileCheck %s
; RUN: verify-uselistorder %s.bc

; Establish a stable order.
!named = !{!0, !1, !2, !3, !4, !6, !7, !8, !9, !10, !11, !12}

; CHECK: !0 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
; CHECK-NEXT: !1 = !DICompositeType(tag: DW_TAG_structure_type, name: "T1"{{.*}}, identifier: "T1")
; CHECK-NEXT: !2 = !DICompositeType(tag: DW_TAG_structure_type, name: "T2", scope: !1{{.*}}, baseType: !1, vtableHolder: !1, identifier: "T2")
; CHECK-NEXT: !3 = !DIDerivedType(tag: DW_TAG_member, name: "M1", scope: !1{{.*}}, baseType: !2)
; CHECK-NEXT: !4 = !DISubroutineType(types: !5)
; CHECK-NEXT: !5 = !{!1, !2}
; CHECK-NEXT: !6 = !DISubprogram(scope: !1,{{.*}} containingType: !1{{[,)]}}
; CHECK-NEXT: !7 = !DILocalVariable(name: "V1", scope: !6, type: !2)
; CHECK-NEXT: !8 = !DIObjCProperty(name: "P1", type: !1)
; CHECK-NEXT: !9 = !DITemplateTypeParameter(type: !1)
; CHECK-NEXT: !10 = !DIGlobalVariable(name: "G",{{.*}} type: !1,{{.*}} variable: i32* @G1)
; CHECK-NEXT: !11 = !DITemplateValueParameter(type: !1, value: i32* @G1)
; CHECK-NEXT: !12 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "T2", scope: !0, entity: !1)

!0 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
!1 = !DICompositeType(tag: DW_TAG_structure_type, name: "T1", file: !0, identifier: "T1")
!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "T2", file: !0, scope: !"T1", baseType: !"T1", vtableHolder: !"T1", identifier: "T2")
!3 = !DIDerivedType(tag: DW_TAG_member, name: "M1", file: !0, scope: !"T1", baseType: !"T2")
!4 = !DISubroutineType(types: !5)
!5 = !{!"T1", !"T2"}
!6 = !DISubprogram(scope: !"T1", isDefinition: false, containingType: !"T1")
!7 = !DILocalVariable(name: "V1", scope: !6, type: !"T2")
!8 = !DIObjCProperty(name: "P1", type: !"T1")
!9 = !DITemplateTypeParameter(type: !"T1")
!10 = !DIGlobalVariable(name: "G", type: !"T1", isDefinition: false, variable: i32* @G1)
!11 = !DITemplateValueParameter(type: !"T1", value: i32* @G1)
!12 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "T2", scope: !0, entity: !"T1")

@G1 = global i32 0
Binary file added llvm/test/Bitcode/dityperefs-3.8.ll.bc
Binary file not shown.
22 changes: 11 additions & 11 deletions llvm/test/CodeGen/X86/dbg-changes-codegen-branch-folding.ll
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,23 @@ attributes #4 = { nounwind }
!3 = !{!4}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "AAA3", file: !1, line: 4, size: 32, align: 8, elements: !5, identifier: "_ZTS4AAA3")
!5 = !{!6, !11, !17, !18}
!6 = !DIDerivedType(tag: DW_TAG_member, name: "text", scope: !"_ZTS4AAA3", file: !1, line: 8, baseType: !7, size: 32, align: 8)
!6 = !DIDerivedType(tag: DW_TAG_member, name: "text", scope: !4, file: !1, line: 8, baseType: !7, size: 32, align: 8)
!7 = !DICompositeType(tag: DW_TAG_array_type, baseType: !8, size: 32, align: 8, elements: !9)
!8 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
!9 = !{!10}
!10 = !DISubrange(count: 4)
!11 = !DISubprogram(name: "AAA3", scope: !"_ZTS4AAA3", file: !1, line: 5, type: !12, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true)
!11 = !DISubprogram(name: "AAA3", scope: !4, file: !1, line: 5, type: !12, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true)
!12 = !DISubroutineType(types: !13)
!13 = !{null, !14, !15}
!14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS4AAA3", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
!14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 64)
!16 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8)
!17 = !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", scope: !"_ZTS4AAA3", file: !1, line: 6, type: !12, isLocal: false, isDefinition: false, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true)
!18 = !DISubprogram(name: "operator const char *", linkageName: "_ZNK4AAA3cvPKcEv", scope: !"_ZTS4AAA3", file: !1, line: 7, type: !19, isLocal: false, isDefinition: false, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true)
!17 = !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", scope: !4, file: !1, line: 6, type: !12, isLocal: false, isDefinition: false, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true)
!18 = !DISubprogram(name: "operator const char *", linkageName: "_ZNK4AAA3cvPKcEv", scope: !4, file: !1, line: 7, type: !19, isLocal: false, isDefinition: false, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true)
!19 = !DISubroutineType(types: !20)
!20 = !{!15, !21}
!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !"_ZTS4AAA3")
!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !4)
!24 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barii", scope: !1, file: !1, line: 11, type: !25, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !28)
!25 = !DISubroutineType(types: !26)
!26 = !{null, !27, !27}
Expand All @@ -155,14 +155,14 @@ attributes #4 = { nounwind }
!29 = !DILocalVariable(name: "param1", arg: 1, scope: !24, file: !1, line: 11, type: !27)
!30 = !DILocalVariable(name: "param2", arg: 2, scope: !24, file: !1, line: 11, type: !27)
!31 = !DILocalVariable(name: "temp", scope: !24, file: !1, line: 12, type: !15)
!32 = !DILocalVariable(name: "var1", scope: !24, file: !1, line: 17, type: !"_ZTS4AAA3")
!33 = !DILocalVariable(name: "var2", scope: !24, file: !1, line: 18, type: !"_ZTS4AAA3")
!34 = distinct !DISubprogram(name: "AAA3", linkageName: "_ZN4AAA3C2EPKc", scope: !"_ZTS4AAA3", file: !1, line: 5, type: !12, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !11, variables: !35)
!32 = !DILocalVariable(name: "var1", scope: !24, file: !1, line: 17, type: !4)
!33 = !DILocalVariable(name: "var2", scope: !24, file: !1, line: 18, type: !4)
!34 = distinct !DISubprogram(name: "AAA3", linkageName: "_ZN4AAA3C2EPKc", scope: !4, file: !1, line: 5, type: !12, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !11, variables: !35)
!35 = !{!36, !38}
!36 = !DILocalVariable(name: "this", arg: 1, scope: !34, type: !37, flags: DIFlagArtificial | DIFlagObjectPointer)
!37 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS4AAA3", size: 64, align: 64)
!37 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, align: 64)
!38 = !DILocalVariable(name: "value", arg: 2, scope: !34, file: !1, line: 5, type: !15)
!39 = distinct !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", scope: !"_ZTS4AAA3", file: !1, line: 6, type: !12, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !17, variables: !40)
!39 = distinct !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", scope: !4, file: !1, line: 6, type: !12, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !17, variables: !40)
!40 = !{!41, !42}
!41 = !DILocalVariable(name: "this", arg: 1, scope: !39, type: !37, flags: DIFlagArtificial | DIFlagObjectPointer)
!42 = !DILocalVariable(name: "value", arg: 2, scope: !39, file: !1, line: 6, type: !15)
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/CodeGen/X86/misched-code-difference-with-debug.ll
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
!3 = !{!4}
!4 = !DICompositeType(tag: DW_TAG_class_type, name: "C", line: 2, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS1C")
!5 = !{!6}
!6 = !DISubprogram(name: "test", file: !1, scope: !"_ZTS1C", type: !7, isDefinition: false)
!6 = !DISubprogram(name: "test", file: !1, scope: !4, type: !7, isDefinition: false)
!7 = !DISubroutineType(types: !8)
!8 = !{!9, !10, !11, !11, !11, null}
!9 = !DIBasicType(encoding: DW_ATE_signed, size: 32, align: 32, name: "int")
!10 = !DIDerivedType(baseType: !"_ZTS1C", tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial)
!10 = !DIDerivedType(baseType: !4, tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial)
!11 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
!13 = distinct !DISubprogram(name: "test_with_debug", linkageName: "test_with_debug", line: 6, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 6, file: !1, scope: !14, type: !15, variables: !17)
!14 = !DIFile(filename: "test.cpp", directory: "")
!15 = !DISubroutineType(types: !16)
!16 = !{null}
!17 = !{!18, !19}
!18 = !DILocalVariable(name: "c", line: 7, scope: !13, file: !14, type: !"_ZTS1C")
!18 = !DILocalVariable(name: "c", line: 7, scope: !13, file: !14, type: !4)
!19 = !DILocalVariable(name: "lc", line: 8, scope: !13, file: !14, type: !11)
!20 = !{!21}
!21 = !DIGlobalVariable(name: "argc", line: 1, isLocal: false, isDefinition: true, scope: null, file: !14, type: !11, variable: i8* @argc)
Expand Down
24 changes: 12 additions & 12 deletions llvm/test/DebugInfo/AArch64/cfi-eof-prologue.ll
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ attributes #3 = { nounwind }
!1 = !DIFile(filename: "<stdin>", directory: "")
!2 = !{}
!3 = !{!4, !13}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", line: 5, size: 64, align: 64, file: !5, elements: !6, vtableHolder: !"_ZTS1A", identifier: "_ZTS1B")
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", line: 5, size: 64, align: 64, file: !5, elements: !6, vtableHolder: !13, identifier: "_ZTS1B")
!5 = !DIFile(filename: "test1.cpp", directory: "")
!6 = !{!7, !8, !12}
!7 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !"_ZTS1B", baseType: !"_ZTS1A")
!8 = !DISubprogram(name: "B", line: 6, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !5, scope: !"_ZTS1B", type: !9)
!7 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !4, baseType: !13)
!8 = !DISubprogram(name: "B", line: 6, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !5, scope: !4, type: !9)
!9 = !DISubroutineType(types: !10)
!10 = !{null, !11}
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1B")
!12 = !DISubprogram(name: "~B", line: 7, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 7, file: !5, scope: !"_ZTS1B", type: !9, containingType: !"_ZTS1B")
!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, size: 64, align: 64, file: !5, elements: !14, vtableHolder: !"_ZTS1A", identifier: "_ZTS1A")
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!12 = !DISubprogram(name: "~B", line: 7, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 7, file: !5, scope: !4, type: !9, containingType: !4)
!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, size: 64, align: 64, file: !5, elements: !14, vtableHolder: !13, identifier: "_ZTS1A")
!14 = !{!15, !22, !26}
!15 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", size: 64, flags: DIFlagArtificial, file: !5, scope: !16, baseType: !17)
!16 = !DIFile(filename: "test1.cpp", directory: "")
Expand All @@ -83,16 +83,16 @@ attributes #3 = { nounwind }
!19 = !DISubroutineType(types: !20)
!20 = !{!21}
!21 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!22 = !DISubprogram(name: "A", line: 2, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !5, scope: !"_ZTS1A", type: !23)
!22 = !DISubprogram(name: "A", line: 2, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !5, scope: !13, type: !23)
!23 = !DISubroutineType(types: !24)
!24 = !{null, !25}
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A")
!26 = !DISubprogram(name: "~A", line: 3, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !5, scope: !"_ZTS1A", type: !23, containingType: !"_ZTS1A")
!28 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC2Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !"_ZTS1B", type: !9, declaration: !8, variables: !29)
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !13)
!26 = !DISubprogram(name: "~A", line: 3, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !5, scope: !13, type: !23, containingType: !13)
!28 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC2Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !4, type: !9, declaration: !8, variables: !29)
!29 = !{!30}
!30 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !31)
!31 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1B")
!32 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC1Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !"_ZTS1B", type: !9, declaration: !8, variables: !33)
!31 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
!32 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC1Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !4, type: !9, declaration: !8, variables: !33)
!33 = !{!34}
!34 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !32, type: !31)
!35 = !{i32 2, !"Dwarf Version", i32 4}
Expand Down
24 changes: 12 additions & 12 deletions llvm/test/DebugInfo/AArch64/frameindices.ll
Original file line number Diff line number Diff line change
Expand Up @@ -167,38 +167,38 @@ attributes #5 = { builtin }
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 2, size: 192, align: 64, file: !5, elements: !6, identifier: "_ZTS1A")
!5 = !DIFile(filename: "test.cpp", directory: "")
!6 = !{!7, !9, !11}
!7 = !DIDerivedType(tag: DW_TAG_member, name: "x4", line: 3, size: 8, align: 8, file: !5, scope: !"_ZTS1A", baseType: !8)
!7 = !DIDerivedType(tag: DW_TAG_member, name: "x4", line: 3, size: 8, align: 8, file: !5, scope: !4, baseType: !8)
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)
!9 = !DIDerivedType(tag: DW_TAG_member, name: "x5", line: 4, size: 64, align: 64, offset: 64, file: !5, scope: !"_ZTS1A", baseType: !10)
!9 = !DIDerivedType(tag: DW_TAG_member, name: "x5", line: 4, size: 64, align: 64, offset: 64, file: !5, scope: !4, baseType: !10)
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: null)
!11 = !DIDerivedType(tag: DW_TAG_member, name: "x6", line: 5, size: 8, align: 8, offset: 128, file: !5, scope: !"_ZTS1A", baseType: !8)
!11 = !DIDerivedType(tag: DW_TAG_member, name: "x6", line: 5, size: 8, align: 8, offset: 128, file: !5, scope: !4, baseType: !8)
!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !13)
!13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!14 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", line: 8, size: 8, align: 8, file: !5, elements: !15, identifier: "_ZTS1B")
!15 = !{!16, !21}
!16 = !DISubprogram(name: "B", line: 9, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 9, file: !5, scope: !"_ZTS1B", type: !17)
!16 = !DISubprogram(name: "B", line: 9, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 9, file: !5, scope: !14, type: !17)
!17 = !DISubroutineType(types: !18)
!18 = !{null, !19, !20}
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1B")
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !14)
!20 = !DIBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed)
!21 = !DISubprogram(name: "~B", line: 10, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 10, file: !5, scope: !"_ZTS1B", type: !22)
!21 = !DISubprogram(name: "~B", line: 10, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 10, file: !5, scope: !14, type: !22)
!22 = !DISubroutineType(types: !23)
!23 = !{null, !19}
!25 = distinct !DISubprogram(name: "f13", linkageName: "_Z3f131A", line: 13, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 13, file: !5, scope: !26, type: !27, variables: !29)
!26 = !DIFile(filename: "test.cpp", directory: "")
!27 = !DISubroutineType(types: !28)
!28 = !{null, !"_ZTS1A"}
!28 = !{null, !4}
!29 = !{!30}
!30 = !DILocalVariable(name: "p1", line: 13, arg: 1, scope: !25, file: !26, type: !"_ZTS1A")
!30 = !DILocalVariable(name: "p1", line: 13, arg: 1, scope: !25, file: !26, type: !4)
!31 = distinct !DISubprogram(name: "f11", linkageName: "_Z3f111A", line: 17, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 17, file: !5, scope: !26, type: !27, variables: !32)
!32 = !{!33}
!33 = !DILocalVariable(name: "p1", line: 17, arg: 1, scope: !31, file: !26, type: !"_ZTS1A")
!33 = !DILocalVariable(name: "p1", line: 17, arg: 1, scope: !31, file: !26, type: !4)
!34 = distinct !DISubprogram(name: "f16", linkageName: "_Z3f16v", line: 18, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 18, file: !5, scope: !26, type: !35, variables: !37)
!35 = !DISubroutineType(types: !36)
!36 = !{null}
!37 = !{!38, !39}
!38 = !DILocalVariable(name: "c", line: 19, scope: !34, file: !26, type: !"_ZTS1A")
!39 = !DILocalVariable(name: "d", line: 20, scope: !34, file: !26, type: !"_ZTS1B")
!38 = !DILocalVariable(name: "c", line: 19, scope: !34, file: !26, type: !4)
!39 = !DILocalVariable(name: "d", line: 20, scope: !34, file: !26, type: !14)
!40 = !{!41, !42}
!41 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !26, type: !20, variable: i64* @a)
!42 = !DIGlobalVariable(name: "b", line: 7, isLocal: false, isDefinition: true, scope: null, file: !26, type: !12, variable: i32** @b)
Expand Down Expand Up @@ -233,7 +233,7 @@ attributes #5 = { builtin }
!71 = !DILocation(line: 15, column: 3, scope: !25, inlinedAt: !66)
!72 = !DILocation(line: 16, column: 1, scope: !25, inlinedAt: !66)
!73 = !DILocation(line: 17, column: 27, scope: !31)
!74 = !DILocalVariable(name: "p1", line: 17, arg: 1, scope: !31, file: !26, type: !"_ZTS1A")
!74 = !DILocalVariable(name: "p1", line: 17, arg: 1, scope: !31, file: !26, type: !4)
!75 = distinct !DILocation(line: 22, column: 3, scope: !34)
!76 = !DIExpression(DW_OP_bit_piece, 8, 120)
!77 = !DILocation(line: 17, column: 12, scope: !31, inlinedAt: !75)
Expand Down
24 changes: 12 additions & 12 deletions llvm/test/DebugInfo/ARM/cfi-eof-prologue.ll
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ attributes #3 = { nounwind }
!1 = !DIFile(filename: "<stdin>", directory: "")
!2 = !{}
!3 = !{!4, !13}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", line: 5, size: 32, align: 32, file: !5, elements: !6, vtableHolder: !"_ZTS1A", identifier: "_ZTS1B")
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", line: 5, size: 32, align: 32, file: !5, elements: !6, vtableHolder: !13, identifier: "_ZTS1B")
!5 = !DIFile(filename: "test1.cpp", directory: "")
!6 = !{!7, !8, !12}
!7 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !"_ZTS1B", baseType: !"_ZTS1A")
!8 = !DISubprogram(name: "B", line: 6, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !5, scope: !"_ZTS1B", type: !9)
!7 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !4, baseType: !13)
!8 = !DISubprogram(name: "B", line: 6, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !5, scope: !4, type: !9)
!9 = !DISubroutineType(types: !10)
!10 = !{null, !11}
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1B")
!12 = !DISubprogram(name: "~B", line: 7, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 7, file: !5, scope: !"_ZTS1B", type: !9, containingType: !"_ZTS1B")
!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, size: 32, align: 32, file: !5, elements: !14, vtableHolder: !"_ZTS1A", identifier: "_ZTS1A")
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!12 = !DISubprogram(name: "~B", line: 7, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 7, file: !5, scope: !4, type: !9, containingType: !4)
!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, size: 32, align: 32, file: !5, elements: !14, vtableHolder: !13, identifier: "_ZTS1A")
!14 = !{!15, !22, !26}
!15 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", size: 32, flags: DIFlagArtificial, file: !5, scope: !16, baseType: !17)
!16 = !DIFile(filename: "test1.cpp", directory: "")
Expand All @@ -84,16 +84,16 @@ attributes #3 = { nounwind }
!19 = !DISubroutineType(types: !20)
!20 = !{!21}
!21 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!22 = !DISubprogram(name: "A", line: 2, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !5, scope: !"_ZTS1A", type: !23)
!22 = !DISubprogram(name: "A", line: 2, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !5, scope: !13, type: !23)
!23 = !DISubroutineType(types: !24)
!24 = !{null, !25}
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A")
!26 = !DISubprogram(name: "~A", line: 3, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !5, scope: !"_ZTS1A", type: !23, containingType: !"_ZTS1A")
!28 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC2Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !"_ZTS1B", type: !9, declaration: !8, variables: !29)
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !13)
!26 = !DISubprogram(name: "~A", line: 3, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !5, scope: !13, type: !23, containingType: !13)
!28 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC2Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !4, type: !9, declaration: !8, variables: !29)
!29 = !{!30}
!30 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !31)
!31 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, baseType: !"_ZTS1B")
!32 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC1Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !"_ZTS1B", type: !9, declaration: !8, variables: !33)
!31 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, baseType: !4)
!32 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC1Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !4, type: !9, declaration: !8, variables: !33)
!33 = !{!34}
!34 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !32, type: !31)
!35 = !{i32 2, !"Dwarf Version", i32 4}
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/DebugInfo/Generic/PR20038.ll
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,16 @@ attributes #2 = { nounwind readnone }
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1C")
!5 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
!6 = !{!7}
!7 = !DISubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1C", type: !8)
!7 = !DISubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !4, type: !8)
!8 = !DISubroutineType(types: !9)
!9 = !{null, !10}
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1C")
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!12 = distinct !DISubprogram(name: "fun4", linkageName: "_Z4fun4v", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !5, scope: !13, type: !14, variables: !2)
!13 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
!14 = !DISubroutineType(types: !15)
!15 = !{null}
!16 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !"_ZTS1C", type: !8, declaration: !7, variables: !2)
!17 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !"_ZTS1C", type: !8, declaration: !7, variables: !2)
!16 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, variables: !2)
!17 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, variables: !2)
!18 = !{i32 2, !"Dwarf Version", i32 4}
!19 = !{i32 2, !"Debug Info Version", i32 3}
!20 = !{!"clang version 3.5.0 "}
Expand All @@ -152,7 +152,7 @@ attributes #2 = { nounwind readnone }
!27 = !DILocation(line: 5, scope: !28)
!28 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
!29 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
!30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1C")
!30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
!31 = !DILocation(line: 0, scope: !17, inlinedAt: !22)
!32 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
!33 = !DILocation(line: 0, scope: !16, inlinedAt: !21)
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/DebugInfo/Generic/dead-argument-order.ll
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ attributes #1 = { nounwind readnone }
!3 = !{!4}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", line: 1, size: 32, align: 32, file: !1, elements: !5, identifier: "_ZTS1S")
!5 = !{!6}
!6 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 1, size: 32, align: 32, file: !1, scope: !"_ZTS1S", baseType: !7)
!6 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 1, size: 32, align: 32, file: !1, scope: !4, baseType: !7)
!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!9 = distinct !DISubprogram(name: "function", linkageName: "_Z8function1Si", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 2, file: !1, scope: !10, type: !11, variables: !13)
!10 = !DIFile(filename: "dead-argument-order.cpp", directory: "/tmp/dbginfo")
!11 = !DISubroutineType(types: !12)
!12 = !{!7, !4, !7}
!13 = !{!14, !15}
!14 = !DILocalVariable(name: "s", line: 2, arg: 1, scope: !9, file: !10, type: !"_ZTS1S")
!14 = !DILocalVariable(name: "s", line: 2, arg: 1, scope: !9, file: !10, type: !4)
!15 = !DILocalVariable(name: "i", line: 2, arg: 2, scope: !9, file: !10, type: !7)
!16 = !{i32 2, !"Dwarf Version", i32 4}
!17 = !{i32 2, !"Debug Info Version", i32 3}
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/DebugInfo/Generic/debug-info-qualifiers.ll
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ attributes #1 = { nounwind readnone }
!4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 2, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1A")
!5 = !DIFile(filename: "debug-info-qualifiers.cpp", directory: "")
!6 = !{!7, !13}
!7 = !DISubprogram(name: "l", linkageName: "_ZNKR1A1lEv", line: 5, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped | DIFlagLValueReference, isOptimized: false, scopeLine: 5, file: !5, scope: !"_ZTS1A", type: !8)
!7 = !DISubprogram(name: "l", linkageName: "_ZNKR1A1lEv", line: 5, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped | DIFlagLValueReference, isOptimized: false, scopeLine: 5, file: !5, scope: !4, type: !8)
!8 = !DISubroutineType(flags: DIFlagLValueReference, types: !9)
!9 = !{null, !10}
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !11)
!11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !"_ZTS1A")
!13 = !DISubprogram(name: "r", linkageName: "_ZNKO1A1rEv", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagObjectPointer | DIFlagRValueReference, isOptimized: false, scopeLine: 7, file: !5, scope: !"_ZTS1A", type: !14)
!11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !4)
!13 = !DISubprogram(name: "r", linkageName: "_ZNKO1A1rEv", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagObjectPointer | DIFlagRValueReference, isOptimized: false, scopeLine: 7, file: !5, scope: !4, type: !14)
!14 = !DISubroutineType(flags: DIFlagRValueReference, types: !9)
!17 = distinct !DISubprogram(name: "g", linkageName: "_Z1gv", line: 10, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 10, file: !5, scope: !18, type: !19, variables: !2)
!18 = !DIFile(filename: "debug-info-qualifiers.cpp", directory: "")
Expand All @@ -85,13 +85,13 @@ attributes #1 = { nounwind readnone }
!24 = !DILocalVariable(name: "a", line: 11, scope: !17, file: !18, type: !4)
!25 = !DILocation(line: 11, scope: !17)
!26 = !DILocalVariable(name: "pl", line: 16, scope: !17, file: !18, type: !27)
!27 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !28, extraData: !"_ZTS1A")
!27 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !28, extraData: !4)
!28 = !DISubroutineType(flags: DIFlagLValueReference, types: !29)
!29 = !{null, !30}
!30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A")
!30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!31 = !DILocation(line: 16, scope: !17)
!32 = !DILocalVariable(name: "pr", line: 21, scope: !17, file: !18, type: !33)
!33 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !34, extraData: !"_ZTS1A")
!33 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !34, extraData: !4)
!34 = !DISubroutineType(flags: DIFlagRValueReference, types: !29)
!35 = !DILocation(line: 21, scope: !17)
!36 = !DILocation(line: 22, scope: !17)
12 changes: 6 additions & 6 deletions llvm/test/DebugInfo/Generic/def-line.ll
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ attributes #1 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fp
!3 = !{!4}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !1, line: 1, size: 8, align: 8, elements: !5, identifier: "_ZTS3foo")
!5 = !{!6, !9, !10}
!6 = !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !"_ZTS3foo", file: !1, line: 2, type: !7, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false)
!6 = !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !4, file: !1, line: 2, type: !7, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false)
!7 = !DISubroutineType(types: !8)
!8 = !{null}
!9 = !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", scope: !"_ZTS3foo", file: !1, line: 4, type: !7, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)
!10 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ev", scope: !"_ZTS3foo", file: !1, line: 5, type: !7, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)
!12 = distinct !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", scope: !"_ZTS3foo", file: !1, line: 7, type: !7, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !9, variables: !2)
!13 = distinct !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ev", scope: !"_ZTS3foo", file: !14, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !10, variables: !2)
!9 = !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", scope: !4, file: !1, line: 4, type: !7, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)
!10 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ev", scope: !4, file: !1, line: 5, type: !7, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)
!12 = distinct !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", scope: !4, file: !1, line: 7, type: !7, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !9, variables: !2)
!13 = distinct !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ev", scope: !4, file: !14, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !10, variables: !2)
!14 = !DIFile(filename: "bar.cpp", directory: "/tmp/dbginfo")
!15 = distinct !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !"_ZTS3foo", file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !6, variables: !2)
!15 = distinct !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !4, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !6, variables: !2)
!16 = !{i32 2, !"Dwarf Version", i32 4}
!17 = !{i32 2, !"Debug Info Version", i32 3}
!18 = !{!"clang version 3.8.0 (trunk 249440) (llvm/trunk 249465)"}
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/DebugInfo/Generic/enum-types.ll
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ attributes #1 = { nounwind readnone }
!7 = distinct !DISubprogram(name: "topA", linkageName: "_Z4topA2EA", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !1, scope: !8, type: !9, variables: !11)
!8 = !DIFile(filename: "a.cpp", directory: "")
!9 = !DISubroutineType(types: !10)
!10 = !{null, !"_ZTS2EA"}
!10 = !{null, !3}
!11 = !{}
!12 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 214102:214133) (llvm/trunk 214102:214132)", isOptimized: false, emissionKind: FullDebug, file: !13, enums: !14, retainedTypes: !14, globals: !11, imports: !11)
!13 = !DIFile(filename: "b.cpp", directory: "")
Expand All @@ -68,9 +68,9 @@ attributes #1 = { nounwind readnone }
!19 = !{i32 2, !"Dwarf Version", i32 2}
!20 = !{i32 2, !"Debug Info Version", i32 3}
!21 = !{!"clang version 3.5.0 (trunk 214102:214133) (llvm/trunk 214102:214132)"}
!22 = !DILocalVariable(name: "sa", line: 5, arg: 1, scope: !7, file: !8, type: !"_ZTS2EA")
!22 = !DILocalVariable(name: "sa", line: 5, arg: 1, scope: !7, file: !8, type: !3)
!23 = !DILocation(line: 5, column: 14, scope: !7)
!24 = !DILocation(line: 6, column: 1, scope: !7)
!25 = !DILocalVariable(name: "sa", line: 5, arg: 1, scope: !17, file: !18, type: !"_ZTS2EA")
!25 = !DILocalVariable(name: "sa", line: 5, arg: 1, scope: !17, file: !18, type: !3)
!26 = !DILocation(line: 5, column: 14, scope: !17)
!27 = !DILocation(line: 6, column: 1, scope: !17)
26 changes: 13 additions & 13 deletions llvm/test/DebugInfo/Generic/incorrect-variable-debugloc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -343,41 +343,41 @@ attributes #3 = { nounwind readnone }
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 10, size: 64, align: 32, file: !5, elements: !6, identifier: "_ZTS1C")
!5 = !DIFile(filename: "incorrect-variable-debug-loc.cpp", directory: "/tmp/dbginfo")
!6 = !{!7, !9, !10}
!7 = !DIDerivedType(tag: DW_TAG_member, name: "j", line: 12, size: 32, align: 32, file: !5, scope: !"_ZTS1C", baseType: !8)
!7 = !DIDerivedType(tag: DW_TAG_member, name: "j", line: 12, size: 32, align: 32, file: !5, scope: !4, baseType: !8)
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!9 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 13, size: 32, align: 32, offset: 32, file: !5, scope: !"_ZTS1C", baseType: !"_ZTS1B")
!10 = !DISubprogram(name: "m_fn3", linkageName: "_ZN1C5m_fn3Ev", line: 11, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 11, file: !5, scope: !"_ZTS1C", type: !11)
!9 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 13, size: 32, align: 32, offset: 32, file: !5, scope: !4, baseType: !14)
!10 = !DISubprogram(name: "m_fn3", linkageName: "_ZN1C5m_fn3Ev", line: 11, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 11, file: !5, scope: !4, type: !11)
!11 = !DISubroutineType(types: !12)
!12 = !{null, !13}
!13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1C")
!13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!14 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", line: 5, size: 32, align: 32, file: !5, elements: !15, identifier: "_ZTS1B")
!15 = !{!16, !17}
!16 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 7, size: 32, align: 32, file: !5, scope: !"_ZTS1B", baseType: !8)
!17 = !DISubprogram(name: "m_fn2", linkageName: "_ZN1B5m_fn2Ev", line: 6, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !5, scope: !"_ZTS1B", type: !18)
!16 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 7, size: 32, align: 32, file: !5, scope: !14, baseType: !8)
!17 = !DISubprogram(name: "m_fn2", linkageName: "_ZN1B5m_fn2Ev", line: 6, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !5, scope: !14, type: !18)
!18 = !DISubroutineType(types: !19)
!19 = !{null, !20}
!20 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1B")
!20 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !14)
!22 = distinct !DISubprogram(name: "fn1", linkageName: "_Z3fn1v", line: 16, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 16, file: !5, scope: !23, type: !24, variables: !26)
!23 = !DIFile(filename: "incorrect-variable-debug-loc.cpp", directory: "/tmp/dbginfo")
!24 = !DISubroutineType(types: !25)
!25 = !{!8}
!26 = !{!27}
!27 = !DILocalVariable(name: "A", line: 17, scope: !22, file: !23, type: !"_ZTS1C")
!28 = distinct !DISubprogram(name: "m_fn3", linkageName: "_ZN1C5m_fn3Ev", line: 21, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 21, file: !5, scope: !"_ZTS1C", type: !11, declaration: !10, variables: !29)
!27 = !DILocalVariable(name: "A", line: 17, scope: !22, file: !23, type: !4)
!28 = distinct !DISubprogram(name: "m_fn3", linkageName: "_ZN1C5m_fn3Ev", line: 21, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 21, file: !5, scope: !4, type: !11, declaration: !10, variables: !29)
!29 = !{!30}
!30 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !31)
!31 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1C")
!32 = distinct !DISubprogram(name: "m_fn2", linkageName: "_ZN1B5m_fn2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 6, file: !5, scope: !"_ZTS1B", type: !18, declaration: !17, variables: !33)
!31 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
!32 = distinct !DISubprogram(name: "m_fn2", linkageName: "_ZN1B5m_fn2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 6, file: !5, scope: !14, type: !18, declaration: !17, variables: !33)
!33 = !{!34}
!34 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !32, type: !35)
!35 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1B")
!35 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !14)
!36 = !{i32 2, !"Dwarf Version", i32 4}
!37 = !{i32 2, !"Debug Info Version", i32 3}
!38 = !{!"clang version 3.5.0 "}
!39 = !DILocation(line: 6, scope: !32, inlinedAt: !40)
!40 = !DILocation(line: 18, scope: !22)
!41 = !{!42, !43, i64 0}
!42 = !{!"_ZTS1B", !43, i64 0}
!42 = !{!14, !43, i64 0}
!43 = !{!"int", !44, i64 0}
!44 = !{!"omnipotent char", !45, i64 0}
!45 = !{!"Simple C/C++ TBAA"}
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/DebugInfo/Generic/member-order.ll
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ attributes #1 = { nounwind readnone }
!6 = !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !4, type: !7)
!7 = !DISubroutineType(types: !8)
!8 = !{null, !9}
!9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS3foo")
!9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!10 = !{i32 786468}
!11 = !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !4, type: !7)
!12 = !{i32 786468}
!14 = distinct !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !1, scope: null, type: !7, declaration: !6, variables: !2)
!15 = !{i32 2, !"Dwarf Version", i32 4}
!16 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !14, type: !17)
!17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS3foo")
!17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
!18 = !DILocation(line: 0, scope: !14)
!19 = !DILocation(line: 7, scope: !14)
!20 = !{i32 1, !"Debug Info Version", i32 3}
6 changes: 3 additions & 3 deletions llvm/test/DebugInfo/Generic/namespace.ll
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,12 @@ attributes #1 = { nounwind readnone }
!38 = distinct !DILexicalBlock(line: 22, column: 10, file: !5, scope: !39)
!39 = distinct !DILexicalBlock(line: 22, column: 7, file: !5, scope: !21)
!40 = !DIImportedEntity(tag: DW_TAG_imported_module, line: 26, scope: !21, entity: !7)
!41 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 27, scope: !21, entity: !"_ZTSN1A1B3fooE")
!42 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 28, scope: !21, entity: !"_ZTSN1A1B3barE")
!41 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 27, scope: !21, entity: !4)
!42 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 28, scope: !21, entity: !8)
!43 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 29, scope: !21, entity: !14)
!44 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 30, scope: !21, entity: !31)
!45 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 31, scope: !21, entity: !46)
!46 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", line: 7, file: !5, scope: !6, baseType: !"_ZTSN1A1B3barE")
!46 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", line: 7, file: !5, scope: !6, baseType: !8)
!47 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 32, name: "X", scope: !21, entity: !7)
!48 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 33, name: "Y", scope: !21, entity: !47)
!49 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 34, scope: !21, entity: !50)
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/DebugInfo/Generic/recursive_inlining.ll
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ attributes #3 = { nounwind }
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 5, size: 32, align: 32, file: !5, elements: !6, identifier: "_ZTS1C")
!5 = !DIFile(filename: "recursive_inlining.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch/missing_concrete_variable_on_darwin/reduce")
!6 = !{!7, !9}
!7 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 6, size: 32, align: 32, file: !5, scope: !"_ZTS1C", baseType: !8)
!7 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 6, size: 32, align: 32, file: !5, scope: !4, baseType: !8)
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!9 = !DISubprogram(name: "m_fn2", linkageName: "_ZN1C5m_fn2Ev", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 7, file: !5, scope: !"_ZTS1C", type: !10)
!9 = !DISubprogram(name: "m_fn2", linkageName: "_ZN1C5m_fn2Ev", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 7, file: !5, scope: !4, type: !10)
!10 = !DISubroutineType(types: !11)
!11 = !{null, !12}
!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1C")
!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!14 = distinct !DISubprogram(name: "fn6", linkageName: "_Z3fn6v", line: 15, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 15, file: !5, scope: !15, type: !16, variables: !2)
!15 = !DIFile(filename: "recursive_inlining.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch/missing_concrete_variable_on_darwin/reduce")
!16 = !DISubroutineType(types: !17)
Expand All @@ -220,10 +220,10 @@ attributes #3 = { nounwind }
!19 = distinct !DISubprogram(name: "fn4", linkageName: "_Z3fn4v", line: 21, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 21, file: !5, scope: !15, type: !16, variables: !2)
!20 = distinct !DISubprogram(name: "fn5", linkageName: "_Z3fn5v", line: 22, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 22, file: !5, scope: !15, type: !16, variables: !2)
!21 = distinct !DISubprogram(name: "fn7", linkageName: "_Z3fn7v", line: 14, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 14, file: !5, scope: !15, type: !16, variables: !2)
!22 = distinct !DISubprogram(name: "m_fn2", linkageName: "_ZN1C5m_fn2Ev", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 7, file: !5, scope: !"_ZTS1C", type: !10, declaration: !9, variables: !23)
!22 = distinct !DISubprogram(name: "m_fn2", linkageName: "_ZN1C5m_fn2Ev", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 7, file: !5, scope: !4, type: !10, declaration: !9, variables: !23)
!23 = !{!24}
!24 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !22, type: !25)
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1C")
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
!26 = !{!27}
!27 = !DIGlobalVariable(name: "x", line: 13, isLocal: false, isDefinition: true, scope: null, file: !15, type: !25, variable: %struct.C** @x)
!28 = !{i32 2, !"Dwarf Version", i32 4}
Expand All @@ -241,7 +241,7 @@ attributes #3 = { nounwind }
!40 = !DILocation(line: 9, scope: !41, inlinedAt: !32)
!41 = distinct !DILexicalBlock(line: 9, column: 0, file: !5, scope: !22)
!42 = !{!43, !44, i64 0}
!43 = !{!"_ZTS1C", !44, i64 0}
!43 = !{!4, !44, i64 0}
!44 = !{!"int", !35, i64 0}
!45 = !DILocation(line: 9, scope: !46, inlinedAt: !32)
!46 = distinct !DILexicalBlock(line: 9, column: 0, file: !5, scope: !41)
Expand Down
30 changes: 15 additions & 15 deletions llvm/test/DebugInfo/Generic/tu-composite.ll
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ attributes #1 = { nounwind readnone }
!1 = !DIFile(filename: "tmp.cpp", directory: ".")
!2 = !{}
!3 = !{!4, !18, !19, !22, !23, !24}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, file: !1, elements: !5, vtableHolder: !"_ZTS1C", identifier: "_ZTS1C")
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, file: !1, elements: !5, vtableHolder: !4, identifier: "_ZTS1C")
!5 = !{!6, !13}
!6 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$C", flags: DIFlagArtificial, file: !1, scope: !7, baseType: !8)
!7 = !DIFile(filename: "tmp.cpp", directory: ".")
Expand All @@ -136,46 +136,46 @@ attributes #1 = { nounwind readnone }
!10 = !DISubroutineType(types: !11)
!11 = !{!12}
!12 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!13 = !DISubprogram(name: "foo", linkageName: "_ZN1C3fooEv", line: 2, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !"_ZTS1C", type: !14, containingType: !"_ZTS1C")
!13 = !DISubprogram(name: "foo", linkageName: "_ZN1C3fooEv", line: 2, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !4, type: !14, containingType: !4)
!14 = !DISubroutineType(types: !15)
!15 = !{null, !16}
!16 = !DIDerivedType(tag: DW_TAG_pointer_type, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1C")
!16 = !DIDerivedType(tag: DW_TAG_pointer_type, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!18 = !DICompositeType(tag: DW_TAG_structure_type, name: "bar", line: 7, size: 8, align: 8, file: !1, elements: !2, identifier: "_ZTS3bar")
!19 = !DICompositeType(tag: DW_TAG_structure_type, name: "D", line: 9, size: 8, align: 8, file: !1, elements: !20, identifier: "_ZTS1D")
!20 = !{!21}
!21 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 11, flags: DIFlagStaticMember, file: !1, scope: !"_ZTS1D", baseType: !12)
!22 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", line: 12, size: 8, align: 8, file: !1, scope: !"_ZTS1D", elements: !2, identifier: "_ZTSN1D6NestedE")
!23 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested2", line: 13, flags: DIFlagFwdDecl, file: !1, scope: !"_ZTS1D", identifier: "_ZTSN1D7Nested2E")
!24 = !DICompositeType(tag: DW_TAG_structure_type, name: "virt<bar>", line: 15, file: !1, scope: !"_ZTS1D", elements: !25, templateParams: !28, identifier: "_ZTSN1D4virtI3barEE")
!21 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 11, flags: DIFlagStaticMember, file: !1, scope: !19, baseType: !12)
!22 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", line: 12, size: 8, align: 8, file: !1, scope: !19, elements: !2, identifier: "_ZTSN1D6NestedE")
!23 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested2", line: 13, flags: DIFlagFwdDecl, file: !1, scope: !19, identifier: "_ZTSN1D7Nested2E")
!24 = !DICompositeType(tag: DW_TAG_structure_type, name: "virt<bar>", line: 15, file: !1, scope: !19, elements: !25, templateParams: !28, identifier: "_ZTSN1D4virtI3barEE")
!25 = !{!26}
!26 = !DIDerivedType(tag: DW_TAG_member, name: "values", line: 16, size: 64, align: 64, file: !1, scope: !"_ZTSN1D4virtI3barEE", baseType: !27)
!27 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS3bar")
!26 = !DIDerivedType(tag: DW_TAG_member, name: "values", line: 16, size: 64, align: 64, file: !1, scope: !24, baseType: !27)
!27 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !18)
!28 = !{!29}
!29 = !DITemplateTypeParameter(name: "T", type: !"_ZTS3bar")
!29 = !DITemplateTypeParameter(name: "T", type: !18)
!31 = distinct !DISubprogram(name: "foo", linkageName: "_ZN1C3fooEv", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 4, file: !1, scope: null, type: !14, declaration: !13, variables: !2)
!32 = distinct !DISubprogram(name: "test", linkageName: "_Z4testv", line: 20, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 20, file: !1, scope: !7, type: !33, variables: !2)
!33 = !DISubroutineType(types: !34)
!34 = !{null}
!35 = !{i32 2, !"Dwarf Version", i32 2}
!36 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !31, type: !37)
!37 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1C")
!37 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
!38 = !DILocation(line: 0, scope: !31)
!39 = !DILocation(line: 5, scope: !31)
!40 = !DILocalVariable(name: "B", line: 21, scope: !32, file: !7, type: !41)
!41 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", line: 8, file: !1, baseType: !"_ZTS3bar")
!41 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", line: 8, file: !1, baseType: !18)
!42 = !DILocation(line: 21, scope: !32)
!43 = !DILocalVariable(name: "A", line: 22, scope: !32, file: !7, type: !44)
!44 = !DICompositeType(tag: DW_TAG_array_type, size: 24, align: 8, baseType: !"_ZTS3bar", elements: !45)
!44 = !DICompositeType(tag: DW_TAG_array_type, size: 24, align: 8, baseType: !18, elements: !45)
!45 = !{!46}
!46 = !DISubrange(count: 3)
!47 = !DILocation(line: 22, scope: !32)
!48 = !DILocalVariable(name: "B2", line: 23, scope: !32, file: !7, type: !49)
!49 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz2", line: 10, file: !1, scope: !"_ZTS1D", baseType: !"_ZTS3bar")
!49 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz2", line: 10, file: !1, scope: !19, baseType: !18)
!50 = !DILocation(line: 23, scope: !32)
!51 = !DILocalVariable(name: "e", line: 24, scope: !32, file: !7, type: !22)
!52 = !DILocation(line: 24, scope: !32)
!53 = !DILocalVariable(name: "p", line: 25, scope: !32, file: !7, type: !54)
!54 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTSN1D7Nested2E")
!54 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !23)
!55 = !DILocation(line: 25, scope: !32)
!56 = !DILocalVariable(name: "t", line: 26, scope: !32, file: !7, type: !24)
!57 = !DILocation(line: 26, scope: !32)
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/DebugInfo/Generic/tu-member-pointer.ll
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
!5 = !{!6}
!6 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !7, type: !8, variable: i64* @x)
!7 = !DIFile(filename: "foo.cpp", directory: ".")
!8 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !9, extraData: !"_ZTS3Foo")
!8 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !9, extraData: !4)
!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!10 = !{i32 2, !"Dwarf Version", i32 2}
!11 = !{i32 1, !"Debug Info Version", i32 3}
4 changes: 2 additions & 2 deletions llvm/test/DebugInfo/Generic/varargs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ attributes #1 = { nounwind readnone }
!3 = !{!4}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 3, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS1A")
!5 = !{!6}
!6 = !DISubprogram(name: "a", linkageName: "_ZN1A1aEiz", line: 6, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !1, scope: !"_ZTS1A", type: !7)
!6 = !DISubprogram(name: "a", linkageName: "_ZN1A1aEiz", line: 6, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !1, scope: !4, type: !7)
!7 = !DISubroutineType(types: !8)
!8 = !{null, !9, !10, null}
!9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A")
!9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!10 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!14 = distinct !DISubprogram(name: "b", linkageName: "_Z1biz", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 13, file: !1, scope: !15, type: !16, variables: !2)
!15 = !DIFile(filename: "llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp", directory: "radar/13690847")
Expand Down
Loading