1; RUN: opt -module-summary -o %t0.o %S/Inputs/type-mapping-bug2.ll 2; RUN: opt -module-summary -o %t1.o %s 3; RUN: llvm-lto2 run -o %t2 %t0.o %t1.o -r %t0.o,c,px -r %t1.o,a,px -r %t1.o,b,px 4; 5; Test for the issue described in https://bugs.llvm.org/show_bug.cgi?id=37684 6 7target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 8target triple = "x86_64-unknown-linux-gnu" 9 10; T1 will be linked against T2 because T2 was already loaded in %t0.o due to 11; the declaration for @b being imported due to !13 12%"T1" = type {} 13%"T2" = type {} 14 15define %"T1" @a() { 16 unreachable 17} 18 19define i1 @b(ptr) { 20 unreachable 21} 22 23!llvm.module.flags = !{!0, !1} 24!llvm.dbg.cu = !{!2} 25!0 = !{i32 2, !"Debug Info Version", i32 3} 26!1 = !{i32 1, !"ThinLTO", i32 0} 27!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, retainedTypes: !4) 28!3 = !DIFile(filename: "f1", directory: "") 29!4 = !{!5, !9} 30!5 = !DICompositeType(tag: DW_TAG_class_type, file: !3, templateParams: !6, scope: !8) 31!6 = !{!7} 32 33; The reference to @b and T2 that will be loaded in %t0.o 34 35!7 = !DITemplateValueParameter(value: ptr @b) 36!8 = distinct !DISubprogram(unit: !2) 37 38; This DICompositeType is uniqued against !5 in Inputs/type-mapping-bug2.ll, 39; causing !7 and hence %T2 to be loaded into it's module 40 41!9 = !DICompositeType(tag: DW_TAG_array_type, identifier: "SHARED", scope: !8) 42 43