1; RUN: llvm-as -o %t.dst.bc %s 2; RUN: llvm-as -o %t.src.bc %S/Inputs/type-mapping-src.ll 3; RUN: llvm-lto %t.dst.bc %t.src.bc -o=%t.lto.bc 4 5source_filename = "test/LTO/X86/type-mapping-bug.ll" 6target triple = "x86_64-pc-windows-msvc18.0.0" 7; @x in Src will be linked with this @x, causing SrcType in Src to be mapped 8; to %DstType. 9 10%DstType = type { i8 } 11%CommonStruct = type { i32 } 12; The Src module will re-use our DINode for this type. 13%Tricky = type opaque 14%Tricky.1 = type { ptr } 15 16@x = global %DstType zeroinitializer 17@foo = internal global %CommonStruct zeroinitializer, !dbg !0 18; That DINode will refer to this value, casted to ptr (!11), 19; which will then show up in Src's getIdentifiedStructTypes(). 20@templateValueParam = global i8 0 21; Because of the names, we would try to map %Tricky.1 to %Tricky -- 22; mapping a Dst type to another Dst type! This would assert when 23; getting a mapping from %DstType, which has previously used as 24; a destination type. Since these types are not in the source module, 25; there should be no attempt to create a mapping involving them; 26; both types should be left as they are. 27@use = global ptr null 28 29; Mark %Tricky used. 30!llvm.dbg.cu = !{!2} 31!llvm.module.flags = !{!14} 32 33!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 34!1 = !DIGlobalVariable(name: "foo", linkageName: "foo", scope: !2, file: !3, line: 5, type: !6, isLocal: false, isDefinition: true) 35!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) 36!3 = !DIFile(filename: "a", directory: "/") 37!4 = !{} 38!5 = !{!0} 39!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !3, line: 5, size: 8, elements: !7, identifier: ".?AUS@@") 40!7 = !{!8} 41!8 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !6, baseType: !9) 42!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Template<&x>", file: !3, line: 3, size: 8, elements: !4, templateParams: !10, identifier: ".?AU?$Template@$1?x@@3UX@@A@@") 43!10 = !{!11} 44!11 = !DITemplateValueParameter(type: !12, value: ptr @templateValueParam) 45!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64) 46!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "X", file: !3, line: 1, size: 8, elements: !4, identifier: ".?AUX@@") 47!14 = !{i32 2, !"Debug Info Version", i32 3} 48 49