diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 836beb89b45..0b72e969d4b 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -958,6 +958,9 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { DIE *ContextDIE = getOrCreateContextDIE(Context); assert(ContextDIE); + // Unique the type. This is a noop if the type has no unique identifier. + Ty = DIType(resolve(Ty.getRef())); + DIE *TyDIE = getDIE(Ty); if (TyDIE) return TyDIE; diff --git a/test/Linker/type-unique-odr-a.ll b/test/Linker/type-unique-odr-a.ll index 6edb0c4bbd6..3ab20bfb323 100644 --- a/test/Linker/type-unique-odr-a.ll +++ b/test/Linker/type-unique-odr-a.ll @@ -28,6 +28,10 @@ ; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZL3barv" ; CHECK: DW_TAG_class_type ; CHECK-NEXT: DW_AT_name {{.*}} "A" +; CHECK-NOT: DW_TAG +; CHECK: DW_TAG_member +; CHECK-NEXT: DW_AT_name {{.*}} "data" +; CHECK-NOT: DW_TAG ; CHECK: DW_TAG_subprogram ; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1A6getFooEv" ; CHECK-NEXT: DW_AT_name {{.*}} "getFoo"