1; Do setup work for all below tests: generate bitcode and combined index
2; RUN: llvm-as -function-summary %s -o %t.bc
3; RUN: llvm-as -function-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 %s -S | FileCheck %s
8
9; CHECK: define available_externally void @func()
10; CHECK: distinct !DISubprogram(name: "main"
11; CHECK: distinct !DISubprogram(name: "func"
12
13; ModuleID = 'funcimport_debug.o'
14target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
15target triple = "x86_64-unknown-linux-gnu"
16
17; Function Attrs: nounwind uwtable
18define i32 @main() #0 !dbg !4 {
19entry:
20  call void (...) @func(), !dbg !11
21  ret i32 0, !dbg !12
22}
23
24declare void @func(...) #1
25
26attributes #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" }
27attributes #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" }
28
29!llvm.dbg.cu = !{!0}
30!llvm.module.flags = !{!8, !9}
31!llvm.ident = !{!10}
32
33!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: 1, enums: !2, subprograms: !3)
34!1 = !DIFile(filename: "funcimport_debug.c", directory: ".")
35!2 = !{}
36!3 = !{!4}
37!4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, variables: !2)
38!5 = !DISubroutineType(types: !6)
39!6 = !{!7}
40!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
41!8 = !{i32 2, !"Dwarf Version", i32 4}
42!9 = !{i32 2, !"Debug Info Version", i32 3}
43!10 = !{!"clang version 3.8.0 (trunk 255685) (llvm/trunk 255682)"}
44!11 = !DILocation(line: 3, column: 3, scope: !4)
45!12 = !DILocation(line: 4, column: 1, scope: !4)
46