Index: include/llvm/IR/DIBuilder.h =================================================================== --- include/llvm/IR/DIBuilder.h +++ include/llvm/IR/DIBuilder.h @@ -120,10 +120,9 @@ /// type. /// \param Name Type name. /// \param SizeInBits Size of the type. - /// \param AlignInBits Type alignment. /// \param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float. DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Encoding); + unsigned Encoding); /// Create debugging information entry for a qualified /// type, e.g. 'const int'. @@ -134,27 +133,27 @@ /// Create debugging information entry for a pointer. /// \param PointeeTy Type pointed by this pointer. /// \param SizeInBits Size. - /// \param AlignInBits Alignment. (optional) + /// \param AlignInBytes Alignment. (optional) /// \param Name Pointer type name. (optional) DIDerivedType *createPointerType(DIType *PointeeTy, uint64_t SizeInBits, - uint64_t AlignInBits = 0, + uint64_t AlignInBytes = 0, StringRef Name = ""); /// Create debugging information entry for a pointer to member. /// \param PointeeTy Type pointed to by this pointer. /// \param SizeInBits Size. - /// \param AlignInBits Alignment. (optional) + /// \param AlignInBytes Alignment. (optional) /// \param Class Type for which this pointer points to members of. DIDerivedType * createMemberPointerType(DIType *PointeeTy, DIType *Class, - uint64_t SizeInBits, uint64_t AlignInBits = 0, + uint64_t SizeInBits, uint64_t AlignInBytes = 0, DINode::DIFlags Flags = DINode::FlagZero); /// Create debugging information entry for a c++ /// style reference or rvalue reference type. DIDerivedType *createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits = 0, - uint64_t AlignInBits = 0); + uint64_t AlignInBytes = 0); /// Create debugging information entry for a typedef. /// \param Ty Original type. @@ -185,13 +184,13 @@ /// \param File File where this member is defined. /// \param LineNo Line number. /// \param SizeInBits Member size. - /// \param AlignInBits Member alignment. + /// \param AlignInBytes Member alignment. /// \param OffsetInBits Member offset. /// \param Flags Flags to encode member attribute, e.g. private /// \param Ty Parent type. DIDerivedType *createMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, uint64_t AlignInBytes, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty); @@ -201,29 +200,32 @@ /// \param File File where this member is defined. /// \param LineNo Line number. /// \param SizeInBits Member size. - /// \param AlignInBits Member alignment. /// \param OffsetInBits Member offset. /// \param StorageOffsetInBits Member storage offset. /// \param Flags Flags to encode member attribute. /// \param Ty Parent type. - DIDerivedType *createBitFieldMemberType( - DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, - uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty); + DIDerivedType *createBitFieldMemberType(DIScope *Scope, StringRef Name, + DIFile *File, unsigned LineNo, + uint64_t SizeInBits, + uint64_t OffsetInBits, + uint64_t StorageOffsetInBits, + DINode::DIFlags Flags, DIType *Ty); /// Create debugging information entry for a /// C++ static data member. - /// \param Scope Member scope. - /// \param Name Member name. - /// \param File File where this member is declared. - /// \param LineNo Line number. - /// \param Ty Type of the static member. - /// \param Flags Flags to encode member attribute, e.g. private. - /// \param Val Const initializer of the member. + /// \param Scope Member scope. + /// \param Name Member name. + /// \param File File where this member is declared. + /// \param LineNo Line number. + /// \param Ty Type of the static member. + /// \param Flags Flags to encode member attribute, e.g. private. + /// \param Val Const initializer of the member. + /// \param AlignInBytes Member alignment. DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, DINode::DIFlags Flags, - llvm::Constant *Val); + llvm::Constant *Val, + uint64_t AlignInBytes = 0); /// Create debugging information entry for Objective-C /// instance variable. @@ -231,13 +233,13 @@ /// \param File File where this member is defined. /// \param LineNo Line number. /// \param SizeInBits Member size. - /// \param AlignInBits Member alignment. + /// \param AlignInBytes Member alignment. /// \param OffsetInBits Member offset. /// \param Flags Flags to encode member attribute, e.g. private /// \param Ty Parent type. /// \param PropertyNode Property associated with this ivar. DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, uint64_t AlignInBytes, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, MDNode *PropertyNode); @@ -262,7 +264,7 @@ /// \param File File where this member is defined. /// \param LineNumber Line number. /// \param SizeInBits Member size. - /// \param AlignInBits Member alignment. + /// \param AlignInBytes Member alignment. /// \param OffsetInBits Member offset. /// \param Flags Flags to encode member attribute, e.g. private /// \param Elements class members. @@ -274,7 +276,7 @@ /// \param UniqueIdentifier A unique identifier for the class. DICompositeType *createClassType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, uint64_t AlignInBytes, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, DIType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr, StringRef UniqueIdentifier = ""); @@ -285,14 +287,14 @@ /// \param File File where this member is defined. /// \param LineNumber Line number. /// \param SizeInBits Member size. - /// \param AlignInBits Member alignment. + /// \param AlignInBytes Member alignment. /// \param Flags Flags to encode member attribute, e.g. private /// \param Elements Struct elements. /// \param RunTimeLang Optional parameter, Objective-C runtime version. /// \param UniqueIdentifier A unique identifier for the struct. DICompositeType *createStructType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags, + uint64_t SizeInBits, uint64_t AlignInBytes, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0, DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = ""); @@ -302,14 +304,14 @@ /// \param File File where this member is defined. /// \param LineNumber Line number. /// \param SizeInBits Member size. - /// \param AlignInBits Member alignment. + /// \param AlignInBytes Member alignment. /// \param Flags Flags to encode member attribute, e.g. private /// \param Elements Union elements. /// \param RunTimeLang Optional parameter, Objective-C runtime version. /// \param UniqueIdentifier A unique identifier for the union. DICompositeType *createUnionType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, uint64_t AlignInBytes, DINode::DIFlags Flags, DINodeArray Elements, unsigned RunTimeLang = 0, @@ -356,18 +358,18 @@ /// Create debugging information entry for an array. /// \param Size Array size. - /// \param AlignInBits Alignment. + /// \param AlignInBytes Alignment. /// \param Ty Element type. /// \param Subscripts Subscripts. - DICompositeType *createArrayType(uint64_t Size, uint64_t AlignInBits, + DICompositeType *createArrayType(uint64_t Size, uint64_t AlignInBytes, DIType *Ty, DINodeArray Subscripts); /// Create debugging information entry for a vector type. /// \param Size Array size. - /// \param AlignInBits Alignment. + /// \param AlignInBytes Alignment. /// \param Ty Element type. /// \param Subscripts Subscripts. - DICompositeType *createVectorType(uint64_t Size, uint64_t AlignInBits, + DICompositeType *createVectorType(uint64_t Size, uint64_t AlignInBytes, DIType *Ty, DINodeArray Subscripts); /// Create debugging information entry for an @@ -377,13 +379,13 @@ /// \param File File where this member is defined. /// \param LineNumber Line number. /// \param SizeInBits Member size. - /// \param AlignInBits Member alignment. + /// \param AlignInBytes Member alignment. /// \param Elements Enumeration elements. /// \param UnderlyingType Underlying type of a C++11/ObjC fixed enum. /// \param UniqueIdentifier A unique identifier for the enum. DICompositeType *createEnumerationType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements, + uint64_t SizeInBits, uint64_t AlignInBytes, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier = ""); /// Create subroutine type. @@ -416,14 +418,14 @@ DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang = 0, uint64_t SizeInBits = 0, - uint64_t AlignInBits = 0, + uint64_t AlignInBytes = 0, StringRef UniqueIdentifier = ""); /// Create a temporary forward-declared type. DICompositeType *createReplaceableCompositeType( unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang = 0, uint64_t SizeInBits = 0, - uint64_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl, + uint64_t AlignInBytes = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl, StringRef UniqueIdentifier = ""); /// Retain DIScope* in a module even if it is not referenced Index: include/llvm/Support/Dwarf.h =================================================================== --- include/llvm/Support/Dwarf.h +++ include/llvm/Support/Dwarf.h @@ -198,6 +198,7 @@ DW_AT_rvalue_reference = 0x78, DW_AT_macros = 0x79, DW_AT_noreturn = 0x87, + DW_AT_alignment = 0x88, DW_AT_lo_user = 0x2000, DW_AT_hi_user = 0x3fff, Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -118,6 +118,10 @@ else addGlobalName(GV->getName(), *VariableDIE, DeclContext); + if (uint64_t AlignInBytes = GV->getAlignInBytes()) + addUInt(*VariableDIE, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata, + AlignInBytes); + // Add location. bool addToAccelTable = false; @@ -771,7 +775,13 @@ StringRef Name = Var.getName(); if (!Name.empty()) addString(VariableDie, dwarf::DW_AT_name, Name); - addSourceLine(VariableDie, Var.getVariable()); + const auto *DIVar = Var.getVariable(); + if (DIVar) + if (uint64_t AlignInBytes = DIVar->getAlignInBytes()) + addUInt(VariableDie, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata, + AlignInBytes); + + addSourceLine(VariableDie, DIVar); addType(VariableDie, Var.getType()); if (Var.isArtificial()) addFlag(VariableDie, dwarf::DW_AT_artificial); Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1007,6 +1007,11 @@ if (RLang) addUInt(Buffer, dwarf::DW_AT_APPLE_runtime_class, dwarf::DW_FORM_data1, RLang); + + // Add align info if available. + if (uint64_t AlignInBytes = CTy->getAlignInBytes()) + addUInt(Buffer, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata, + AlignInBytes); } } @@ -1394,6 +1399,7 @@ } else { uint64_t Size = DT->getSizeInBits(); uint64_t FieldSize = DD->getBaseTypeSize(DT); + uint64_t AlignInBytes = DT->getAlignInBytes(); uint64_t OffsetInBytes; bool IsBitfield = FieldSize && Size != FieldSize; @@ -1431,6 +1437,9 @@ } else { // This is not a bitfield. OffsetInBytes = DT->getOffsetInBits() / 8; + if (AlignInBytes) + addUInt(MemberDie, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata, + AlignInBytes); } if (DD->getDwarfVersion() <= 2) { @@ -1507,6 +1516,10 @@ if (const ConstantFP *CFP = dyn_cast_or_null(DT->getConstant())) addConstantFPValue(StaticMemberDIE, CFP); + if (uint64_t AlignInBytes = DT->getAlignInBytes()) + addUInt(StaticMemberDIE, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata, + AlignInBytes); + return &StaticMemberDIE; } Index: lib/IR/DIBuilder.cpp =================================================================== --- lib/IR/DIBuilder.cpp +++ lib/IR/DIBuilder.cpp @@ -195,11 +195,10 @@ } DIBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Encoding) { assert(!Name.empty() && "Unable to create type without name"); return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits, - AlignInBits, Encoding); + 0, Encoding); } DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) { @@ -209,30 +208,30 @@ DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy, uint64_t SizeInBits, - uint64_t AlignInBits, + uint64_t AlignInBytes, StringRef Name) { // FIXME: Why is there a name here? return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name, nullptr, 0, nullptr, PointeeTy, SizeInBits, - AlignInBits, 0, DINode::FlagZero); + AlignInBytes, 0, DINode::FlagZero); } DIDerivedType *DIBuilder::createMemberPointerType(DIType *PointeeTy, DIType *Base, uint64_t SizeInBits, - uint64_t AlignInBits, + uint64_t AlignInBytes, DINode::DIFlags Flags) { return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "", nullptr, 0, nullptr, PointeeTy, SizeInBits, - AlignInBits, 0, Flags, Base); + AlignInBytes, 0, Flags, Base); } DIDerivedType *DIBuilder::createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits, - uint64_t AlignInBits) { + uint64_t AlignInBytes) { assert(RTy && "Unable to create reference type"); return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy, - SizeInBits, AlignInBits, 0, DINode::FlagZero); + SizeInBits, AlignInBytes, 0, DINode::FlagZero); } DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name, @@ -261,12 +260,12 @@ DIDerivedType *DIBuilder::createMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, - uint64_t AlignInBits, + uint64_t AlignInBytes, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty) { return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File, LineNumber, getNonCompileUnitScope(Scope), Ty, - SizeInBits, AlignInBits, OffsetInBits, Flags); + SizeInBits, AlignInBytes, OffsetInBits, Flags); } static ConstantAsMetadata *getConstantOrNull(Constant *C) { @@ -277,34 +276,36 @@ DIDerivedType *DIBuilder::createBitFieldMemberType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, - uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty) { + uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, + DINode::DIFlags Flags, DIType *Ty) { Flags |= DINode::FlagBitField; return DIDerivedType::get( VMContext, dwarf::DW_TAG_member, Name, File, LineNumber, - getNonCompileUnitScope(Scope), Ty, SizeInBits, AlignInBits, OffsetInBits, - Flags, ConstantAsMetadata::get(ConstantInt::get( - IntegerType::get(VMContext, 64), StorageOffsetInBits))); + getNonCompileUnitScope(Scope), Ty, SizeInBits, /* Align */ 0, + OffsetInBits, Flags, + ConstantAsMetadata::get(ConstantInt::get(IntegerType::get(VMContext, 64), + StorageOffsetInBits))); } DIDerivedType * DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, DIType *Ty, - DINode::DIFlags Flags, llvm::Constant *Val) { + DINode::DIFlags Flags, llvm::Constant *Val, + uint64_t AlignInBytes) { Flags |= DINode::FlagStaticMember; return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File, - LineNumber, getNonCompileUnitScope(Scope), Ty, 0, 0, - 0, Flags, getConstantOrNull(Val)); + LineNumber, getNonCompileUnitScope(Scope), Ty, 0, + AlignInBytes, 0, Flags, getConstantOrNull(Val)); } DIDerivedType * DIBuilder::createObjCIVar(StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, uint64_t AlignInBytes, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, MDNode *PropertyNode) { return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File, LineNumber, getNonCompileUnitScope(File), Ty, - SizeInBits, AlignInBits, OffsetInBits, Flags, + SizeInBits, AlignInBytes, OffsetInBits, Flags, PropertyNode); } @@ -357,7 +358,7 @@ DICompositeType *DIBuilder::createClassType( DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, uint64_t AlignInBytes, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) { assert((!Context || isa(Context)) && @@ -365,7 +366,7 @@ auto *R = DICompositeType::get( VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber, - getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits, + getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBytes, OffsetInBits, Flags, Elements, 0, VTableHolder, cast_or_null(TemplateParams), UniqueIdentifier); trackIfUnresolved(R); @@ -374,12 +375,12 @@ DICompositeType *DIBuilder::createStructType( DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags, + uint64_t SizeInBits, uint64_t AlignInBytes, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang, DIType *VTableHolder, StringRef UniqueIdentifier) { auto *R = DICompositeType::get( VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber, - getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits, 0, + getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBytes, 0, Flags, Elements, RunTimeLang, VTableHolder, nullptr, UniqueIdentifier); trackIfUnresolved(R); return R; @@ -387,11 +388,11 @@ DICompositeType *DIBuilder::createUnionType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags, + uint64_t SizeInBits, uint64_t AlignInBytes, DINode::DIFlags Flags, DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) { auto *R = DICompositeType::get( VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber, - getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags, + getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBytes, 0, Flags, Elements, RunTimeLang, nullptr, nullptr, UniqueIdentifier); trackIfUnresolved(R); return R; @@ -413,32 +414,32 @@ DICompositeType *DIBuilder::createEnumerationType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements, + uint64_t SizeInBits, uint64_t AlignInBytes, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier) { auto *CTy = DICompositeType::get( VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber, - getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0, - DINode::FlagZero, Elements, 0, nullptr, nullptr, UniqueIdentifier); + getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBytes, + 0, DINode::FlagZero, Elements, 0, nullptr, nullptr, UniqueIdentifier); AllEnumTypes.push_back(CTy); trackIfUnresolved(CTy); return CTy; } -DICompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits, +DICompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBytes, DIType *Ty, DINodeArray Subscripts) { auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", - nullptr, 0, nullptr, Ty, Size, AlignInBits, 0, + nullptr, 0, nullptr, Ty, Size, AlignInBytes, 0, DINode::FlagZero, Subscripts, 0, nullptr); trackIfUnresolved(R); return R; } DICompositeType *DIBuilder::createVectorType(uint64_t Size, - uint64_t AlignInBits, DIType *Ty, + uint64_t AlignInBytes, DIType *Ty, DINodeArray Subscripts) { auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", - nullptr, 0, nullptr, Ty, Size, AlignInBits, 0, + nullptr, 0, nullptr, Ty, Size, AlignInBytes, 0, DINode::FlagVector, Subscripts, 0, nullptr); trackIfUnresolved(R); return R; @@ -479,13 +480,13 @@ DICompositeType * DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, uint64_t AlignInBytes, StringRef UniqueIdentifier) { // FIXME: Define in terms of createReplaceableForwardDecl() by calling // replaceWithUniqued(). auto *RetTy = DICompositeType::get( VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr, - SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang, + SizeInBits, AlignInBytes, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang, nullptr, nullptr, UniqueIdentifier); trackIfUnresolved(RetTy); return RetTy; @@ -493,12 +494,12 @@ DICompositeType *DIBuilder::createReplaceableCompositeType( unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, - unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits, + unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBytes, DINode::DIFlags Flags, StringRef UniqueIdentifier) { auto *RetTy = DICompositeType::getTemporary( VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr, - SizeInBits, AlignInBits, 0, Flags, nullptr, RuntimeLang, nullptr, + SizeInBits, AlignInBytes, 0, Flags, nullptr, RuntimeLang, nullptr, nullptr, UniqueIdentifier) .release(); trackIfUnresolved(RetTy); Index: lib/Support/Dwarf.cpp =================================================================== --- lib/Support/Dwarf.cpp +++ lib/Support/Dwarf.cpp @@ -148,6 +148,8 @@ case DW_AT_reference: return "DW_AT_reference"; case DW_AT_rvalue_reference: return "DW_AT_rvalue_reference"; case DW_AT_noreturn: return "DW_AT_noreturn"; + case DW_AT_alignment: + return "DW_AT_alignment"; case DW_AT_MIPS_loop_begin: return "DW_AT_MIPS_loop_begin"; case DW_AT_MIPS_tail_loop_begin: return "DW_AT_MIPS_tail_loop_begin"; case DW_AT_MIPS_epilog_begin: return "DW_AT_MIPS_epilog_begin"; Index: test/DebugInfo/X86/align_c11.ll =================================================================== --- /dev/null +++ test/DebugInfo/X86/align_c11.ll @@ -0,0 +1,83 @@ +; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s +; REQUIRES: object-emission + +; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source +; +; // every object of type struct data will be aligned to 128-byte boundary +; struct data { +; char x; +; _Alignas(128) char arr[2]; +; }; +; +; _Alignas(2048) struct data d; // this instance of data is aligned even stricter +; int foo(void) +; { +; struct data local_data; +; return 0; +; } + +; CHECK: DW_TAG_variable +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"d" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}2048 +; CHECK: DW_TAG_structure_type +; CHECK: DW_TAG_member +; CHECK: DW_TAG_member +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"arr" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}128 + +; ModuleID = 'test.c' +source_filename = "test.c" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +%struct.data = type { i8, [127 x i8], [2 x i8], [126 x i8] } + +@d = common global %struct.data zeroinitializer, align 2048, !dbg !0 + +; Function Attrs: nounwind uwtable +define i32 @foo() #0 !dbg !17 { +entry: + %local_data = alloca %struct.data, align 128 + call void @llvm.dbg.declare(metadata %struct.data* %local_data, metadata !21, metadata !22), !dbg !23 + ret i32 0, !dbg !24 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind readnone } + +!llvm.dbg.cu = !{!1} +!llvm.module.flags = !{!14, !15} +!llvm.ident = !{!16} + +!0 = distinct !DIGlobalVariable(name: "d", scope: !1, file: !5, line: 7, type: !6, isLocal: false, isDefinition: true, align: 2048) +!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4) +!2 = !DIFile(filename: "test.c", directory: "/tmp") +!3 = !{} +!4 = !{!0} +!5 = !DIFile(filename: "test.c", directory: "/tmp") +!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "data", file: !5, line: 2, size: 2048, elements: !7) +!7 = !{!8, !10} +!8 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !6, file: !5, line: 3, baseType: !9, size: 8) +!9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) +!10 = !DIDerivedType(tag: DW_TAG_member, name: "arr", scope: !6, file: !5, line: 4, baseType: !11, size: 16, align: 128, offset: 1024) +!11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 16, elements: !12) +!12 = !{!13} +!13 = !DISubrange(count: 2) +!14 = !{i32 2, !"Dwarf Version", i32 4} +!15 = !{i32 2, !"Debug Info Version", i32 3} +!16 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)"} +!17 = distinct !DISubprogram(name: "foo", scope: !5, file: !5, line: 8, type: !18, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, unit: !1, variables: !3) +!18 = !DISubroutineType(types: !19) +!19 = !{!20} +!20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!21 = !DILocalVariable(name: "local_data", scope: !17, file: !5, line: 10, type: !6) +!22 = !DIExpression() +!23 = !DILocation(line: 10, column: 17, scope: !17) +!24 = !DILocation(line: 11, column: 5, scope: !17) Index: test/DebugInfo/X86/align_cpp11.ll =================================================================== --- /dev/null +++ test/DebugInfo/X86/align_cpp11.ll @@ -0,0 +1,172 @@ +; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s +; REQUIRES: object-emission + +; Generated by clang++ -c -g -std=c++11 -S -emit-llvm from the following C++11 source +; struct S { +; char x; +; alignas(128) char xx; +; }; +; +; class alignas(64) C0 { +; }; +; +; class C1 { +; alignas(64) static void *p; +; }; +; +; enum alignas(16) E { +; A, +; B, +; C, +; }; +; +; C0 c0; +; +; alignas(2048) S s; +; +; void foo() +; { +; S ss; +; E e; +; C1 c1; +; alignas(32) int i = 42; +; auto Lambda = [i](){}; +; } + +; CHECK: DW_TAG_class_type +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"C0" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}64 + +; CHECK: DW_TAG_variable +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"s" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}2048 + +; CHECK: DW_TAG_structure_type +; CHECK: DW_TAG_member +; CHECK: DW_AT_name{{.*}}"xx" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}128 + +; CHECK: DW_TAG_enumeration_type +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}16 + +; CHECK: DW_TAG_variable +; CHECK: DW_AT_name{{.*}}"i" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}32 +; CHECK: DW_TAG_class_type +; CHECK: DW_TAG_member +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"i" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}32 + +; CHECK: DW_TAG_class_type +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"C1" +; CHECK: DW_TAG_member +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"p" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}64 + +; ModuleID = 'test.cpp' +source_filename = "test.cpp" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +%class.C0 = type { [64 x i8] } +%struct.S = type { i8, [127 x i8], i8, [127 x i8] } +%class.C1 = type { i8 } +%class.anon = type { i32 } + +@c0 = global %class.C0 zeroinitializer, align 64, !dbg !0 +@s = global %struct.S zeroinitializer, align 2048, !dbg !11 + +; Function Attrs: nounwind uwtable +define void @_Z3foov() #0 !dbg !22 { +entry: + %ss = alloca %struct.S, align 128 + %e = alloca i32, align 16 + %c1 = alloca %class.C1, align 1 + %i = alloca i32, align 32 + %Lambda = alloca %class.anon, align 4 + call void @llvm.dbg.declare(metadata %struct.S* %ss, metadata !25, metadata !26), !dbg !27 + call void @llvm.dbg.declare(metadata i32* %e, metadata !28, metadata !26), !dbg !29 + call void @llvm.dbg.declare(metadata %class.C1* %c1, metadata !30, metadata !26), !dbg !35 + call void @llvm.dbg.declare(metadata i32* %i, metadata !36, metadata !26), !dbg !38 + store i32 42, i32* %i, align 32, !dbg !38 + call void @llvm.dbg.declare(metadata %class.anon* %Lambda, metadata !39, metadata !26), !dbg !48 + %0 = getelementptr inbounds %class.anon, %class.anon* %Lambda, i32 0, i32 0, !dbg !49 + %1 = load i32, i32* %i, align 32, !dbg !50 + store i32 %1, i32* %0, align 4, !dbg !49 + ret void, !dbg !51 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind readnone } + +!llvm.dbg.cu = !{!1} +!llvm.module.flags = !{!19, !20} +!llvm.ident = !{!21} + +!0 = distinct !DIGlobalVariable(name: "c0", scope: !1, file: !5, line: 19, type: !17, isLocal: false, isDefinition: true) +!1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !10) +!2 = !DIFile(filename: "test.cpp", directory: "/tmp") +!3 = !{!4} +!4 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E", file: !5, line: 13, size: 32, align: 16, elements: !6, identifier: "_ZTS1E") +!5 = !DIFile(filename: "./test.cpp", directory: "/tmp") +!6 = !{!7, !8, !9} +!7 = !DIEnumerator(name: "A", value: 0) +!8 = !DIEnumerator(name: "B", value: 1) +!9 = !DIEnumerator(name: "C", value: 2) +!10 = !{!0, !11} +!11 = distinct !DIGlobalVariable(name: "s", scope: !1, file: !5, line: 21, type: !12, isLocal: false, isDefinition: true, align: 2048) +!12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 2048, elements: !13, identifier: "_ZTS1S") +!13 = !{!14, !16} +!14 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !12, file: !5, line: 2, baseType: !15, size: 8) +!15 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) +!16 = !DIDerivedType(tag: DW_TAG_member, name: "xx", scope: !12, file: !5, line: 3, baseType: !15, size: 8, align: 128, offset: 1024) +!17 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C0", file: !5, line: 6, size: 512, align: 64, elements: !18, identifier: "_ZTS2C0") +!18 = !{} +!19 = !{i32 2, !"Dwarf Version", i32 4} +!20 = !{i32 2, !"Debug Info Version", i32 3} +!21 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)"} +!22 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !5, file: !5, line: 23, type: !23, isLocal: false, isDefinition: true, scopeLine: 24, flags: DIFlagPrototyped, isOptimized: false, unit: !1, variables: !18) +!23 = !DISubroutineType(types: !24) +!24 = !{null} +!25 = !DILocalVariable(name: "ss", scope: !22, file: !5, line: 25, type: !12) +!26 = !DIExpression() +!27 = !DILocation(line: 25, column: 7, scope: !22) +!28 = !DILocalVariable(name: "e", scope: !22, file: !5, line: 26, type: !4) +!29 = !DILocation(line: 26, column: 7, scope: !22) +!30 = !DILocalVariable(name: "c1", scope: !22, file: !5, line: 27, type: !31) +!31 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C1", file: !5, line: 9, size: 8, elements: !32, identifier: "_ZTS2C1") +!32 = !{!33} +!33 = !DIDerivedType(tag: DW_TAG_member, name: "p", scope: !31, file: !5, line: 10, baseType: !34, align: 64, flags: DIFlagStaticMember) +!34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +!35 = !DILocation(line: 27, column: 8, scope: !22) +!36 = !DILocalVariable(name: "i", scope: !22, file: !5, line: 28, type: !37, align: 32) +!37 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!38 = !DILocation(line: 28, column: 21, scope: !22) +!39 = !DILocalVariable(name: "Lambda", scope: !22, file: !5, line: 29, type: !40) +!40 = distinct !DICompositeType(tag: DW_TAG_class_type, scope: !22, file: !5, line: 29, size: 32, elements: !41) +!41 = !{!42, !43} +!42 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !40, file: !5, line: 29, baseType: !37, size: 32, align: 32) +!43 = !DISubprogram(name: "operator()", scope: !40, file: !5, line: 29, type: !44, isLocal: false, isDefinition: false, scopeLine: 29, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false) +!44 = !DISubroutineType(types: !45) +!45 = !{null, !46} +!46 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !47, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) +!47 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !40) +!48 = !DILocation(line: 29, column: 10, scope: !22) +!49 = !DILocation(line: 29, column: 19, scope: !22) +!50 = !DILocation(line: 29, column: 20, scope: !22) +!51 = !DILocation(line: 30, column: 1, scope: !22) Index: test/DebugInfo/X86/align_objc.ll =================================================================== --- /dev/null +++ test/DebugInfo/X86/align_objc.ll @@ -0,0 +1,98 @@ +; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s +; REQUIRES: object-emission + +; typedef struct __attribute__((aligned (128))) { +; char c; +; } S0; +; +; typedef struct { +; __attribute__((aligned (64))) char c; +; } S1; +; +; S0 s0; +; +; void f() { +; S1 s1; +; __attribute__((aligned (32))) int i; +; } + +; CHECK: DW_TAG_typedef +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"S0" +; CHECK: DW_TAG_structure_type +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}128 + +; CHECK: DW_TAG_variable +; CHECK: DW_AT_name{{.*}}"i" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}32 + +; CHECK: DW_TAG_typedef +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"S1" +; CHECK: DW_TAG_structure_type +; CHECK: DW_TAG_member +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}"c" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_alignment{{.*}}64 + +; ModuleID = 'test.m' +source_filename = "test.m" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +%struct.S0 = type { i8, [127 x i8] } +%struct.S1 = type { i8, [63 x i8] } + +@s0 = common global %struct.S0 zeroinitializer, align 128, !dbg !0 + +; Function Attrs: nounwind uwtable +define void @f() #0 !dbg !14 { +entry: + %s1 = alloca %struct.S1, align 64 + %i = alloca i32, align 32 + call void @llvm.dbg.declare(metadata %struct.S1* %s1, metadata !17, metadata !22), !dbg !23 + call void @llvm.dbg.declare(metadata i32* %i, metadata !24, metadata !22), !dbg !26 + ret void, !dbg !27 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind readnone } + +!llvm.dbg.cu = !{!1} +!llvm.module.flags = !{!11, !12} +!llvm.ident = !{!13} + +!0 = distinct !DIGlobalVariable(name: "s0", scope: !1, file: !5, line: 10, type: !6, isLocal: false, isDefinition: true) +!1 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !2, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)", isOptimized: false, runtimeVersion: 1, emissionKind: FullDebug, enums: !3, globals: !4) +!2 = !DIFile(filename: "test.m", directory: "/tmp") +!3 = !{} +!4 = !{!0} +!5 = !DIFile(filename: "test.m", directory: "/tmp") +!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "S0", file: !5, line: 3, baseType: !7) +!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !5, line: 1, size: 1024, align: 128, elements: !8) +!8 = !{!9} +!9 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !7, file: !5, line: 2, baseType: !10, size: 8) +!10 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) +!11 = !{i32 2, !"Dwarf Version", i32 4} +!12 = !{i32 2, !"Debug Info Version", i32 3} +!13 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)"} +!14 = distinct !DISubprogram(name: "f", scope: !5, file: !5, line: 12, type: !15, isLocal: false, isDefinition: true, scopeLine: 12, isOptimized: false, unit: !1, variables: !3) +!15 = !DISubroutineType(types: !16) +!16 = !{null} +!17 = !DILocalVariable(name: "s1", scope: !14, file: !5, line: 13, type: !18) +!18 = !DIDerivedType(tag: DW_TAG_typedef, name: "S1", file: !5, line: 8, baseType: !19) +!19 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !5, line: 6, size: 512, elements: !20) +!20 = !{!21} +!21 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !19, file: !5, line: 7, baseType: !10, size: 8, align: 64) +!22 = !DIExpression() +!23 = !DILocation(line: 13, column: 6, scope: !14) +!24 = !DILocalVariable(name: "i", scope: !14, file: !5, line: 14, type: !25, align: 32) +!25 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!26 = !DILocation(line: 14, column: 37, scope: !14) +!27 = !DILocation(line: 15, column: 1, scope: !14) Index: test/DebugInfo/X86/dwarf-public-names.ll =================================================================== --- test/DebugInfo/X86/dwarf-public-names.ll +++ test/DebugInfo/X86/dwarf-public-names.ll @@ -102,11 +102,11 @@ !4 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") !5 = !DISubroutineType(types: !6) !6 = !{null, !7} -!7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8) -!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !37, elements: !9) +!7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8) +!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, file: !37, elements: !9) !9 = !{!10, !12, !14} !10 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", line: 4, flags: DIFlagStaticMember, file: !37, scope: !8, baseType: !11) -!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, encoding: DW_ATE_signed) !12 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !4, scope: !8, type: !5, variables: !13) !13 = !{} ; previously: invalid DW_TAG_base_type !14 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !4, scope: !8, type: !15, variables: !17) @@ -124,7 +124,7 @@ !26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8) !27 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11) !28 = !DILocalVariable(name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29) -!29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8) +!29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, baseType: !8) !30 = !DILocation(line: 9, scope: !3) !31 = !DILocation(line: 10, scope: !3) !32 = !DILocation(line: 11, scope: !3) Index: unittests/Transforms/Utils/Cloning.cpp =================================================================== --- unittests/Transforms/Utils/Cloning.cpp +++ unittests/Transforms/Utils/Cloning.cpp @@ -253,8 +253,7 @@ Instruction* Terminator = IBuilder.CreateRetVoid(); // Create a local variable around the alloca - auto *IntType = - DBuilder.createBasicType("int", 32, 0, dwarf::DW_ATE_signed); + auto *IntType = DBuilder.createBasicType("int", 32, dwarf::DW_ATE_signed); auto *E = DBuilder.createExpression(); auto *Variable = DBuilder.createAutoVariable(Subprogram, "x", File, 5, IntType, true);