1; Do setup work for all below tests: generate bitcode and combined index 2; RUN: opt -module-summary %s -o %t.bc 3; RUN: opt -module-summary %p/Inputs/funcimport_debug.ll -o %t2.bc 4; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc 5 6; Do the import now and confirm that metadata is linked for imported function. 7; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -S | FileCheck %s 8 9; CHECK: define available_externally void @func() 10 11; Check that we have exactly two subprograms (that func's subprogram wasn't 12; linked more than once for example), and that they are connected to 13; the subprogram list on a compute unit. 14; CHECK: !{{[0-9]+}} = distinct !DICompileUnit({{.*}} subprograms: ![[SPs1:[0-9]+]] 15; CHECK: ![[SPs1]] = !{![[MAINSP:[0-9]+]]} 16; CHECK: ![[MAINSP]] = distinct !DISubprogram(name: "main" 17; CHECK: !{{[0-9]+}} = distinct !DICompileUnit({{.*}} subprograms: ![[SPs2:[0-9]+]] 18; CHECK-NOT: ![[SPs2]] = !{{{.*}}null{{.*}}} 19; CHECK: ![[SPs2]] = !{![[FUNCSP:[0-9]+]]} 20; CHECK: ![[FUNCSP]] = distinct !DISubprogram(name: "func" 21; CHECK-NOT: distinct !DISubprogram 22 23; ModuleID = 'funcimport_debug.o' 24target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 25target triple = "x86_64-unknown-linux-gnu" 26 27; Function Attrs: nounwind uwtable 28define i32 @main() #0 !dbg !4 { 29entry: 30 call void (...) @func(), !dbg !11 31 ret i32 0, !dbg !12 32} 33 34declare void @func(...) #1 35 36attributes #0 = { nounwind uwtable "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-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 37attributes #1 = { "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-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 38 39!llvm.dbg.cu = !{!0} 40!llvm.module.flags = !{!8, !9} 41!llvm.ident = !{!10} 42 43!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 255685) (llvm/trunk 255682)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, subprograms: !3) 44!1 = !DIFile(filename: "funcimport_debug.c", directory: ".") 45!2 = !{} 46!3 = !{!4} 47!4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, variables: !2) 48!5 = !DISubroutineType(types: !6) 49!6 = !{!7} 50!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 51!8 = !{i32 2, !"Dwarf Version", i32 4} 52!9 = !{i32 2, !"Debug Info Version", i32 3} 53!10 = !{!"clang version 3.8.0 (trunk 255685) (llvm/trunk 255682)"} 54!11 = !DILocation(line: 3, column: 3, scope: !4) 55!12 = !DILocation(line: 4, column: 1, scope: !4) 56