1*e5a61917STeresa Johnson; Do setup work for all below tests: generate bitcode and combined index 2*e5a61917STeresa Johnson; RUN: llvm-as -function-summary %s -o %t.bc 3*e5a61917STeresa Johnson; RUN: llvm-as -function-summary %p/Inputs/thinlto_funcimport_debug.ll -o %t2.bc 4*e5a61917STeresa Johnson; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc 5*e5a61917STeresa Johnson 6*e5a61917STeresa Johnson; Confirm that we link the metadata for the imported module. 7*e5a61917STeresa Johnson; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=func1:%t.bc -S | FileCheck %s 8*e5a61917STeresa Johnson 9*e5a61917STeresa Johnson; CHECK: declare i32 @func2 10*e5a61917STeresa Johnson; CHECK: define available_externally i32 @func1 11*e5a61917STeresa Johnson; CHECK: distinct !DISubprogram(name: "func1" 12*e5a61917STeresa Johnson; CHECK: distinct !DISubprogram(name: "func2" 13*e5a61917STeresa Johnson 14*e5a61917STeresa Johnson; ModuleID = 'dbg.o' 15*e5a61917STeresa Johnsontarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 16*e5a61917STeresa Johnsontarget triple = "x86_64-unknown-linux-gnu" 17*e5a61917STeresa Johnson 18*e5a61917STeresa Johnson; Function Attrs: nounwind readnone uwtable 19*e5a61917STeresa Johnsondefine i32 @func1(i32 %n) #0 !dbg !4 { 20*e5a61917STeresa Johnsonentry: 21*e5a61917STeresa Johnson tail call void @llvm.dbg.value(metadata i32 %n, i64 0, metadata !9, metadata !17), !dbg !18 22*e5a61917STeresa Johnson tail call void @llvm.dbg.value(metadata i32 5, i64 0, metadata !10, metadata !17), !dbg !19 23*e5a61917STeresa Johnson %cmp = icmp sgt i32 %n, 10, !dbg !20 24*e5a61917STeresa Johnson %. = select i1 %cmp, i32 10, i32 5, !dbg !22 25*e5a61917STeresa Johnson tail call void @llvm.dbg.value(metadata i32 %., i64 0, metadata !10, metadata !17), !dbg !19 26*e5a61917STeresa Johnson ret i32 %., !dbg !23 27*e5a61917STeresa Johnson} 28*e5a61917STeresa Johnson 29*e5a61917STeresa Johnson; Function Attrs: nounwind readnone uwtable 30*e5a61917STeresa Johnsondefine i32 @func2(i32 %n) #0 !dbg !11 { 31*e5a61917STeresa Johnsonentry: 32*e5a61917STeresa Johnson tail call void @llvm.dbg.value(metadata i32 %n, i64 0, metadata !13, metadata !17), !dbg !24 33*e5a61917STeresa Johnson ret i32 %n, !dbg !25 34*e5a61917STeresa Johnson} 35*e5a61917STeresa Johnson 36*e5a61917STeresa Johnson; Function Attrs: nounwind readnone 37*e5a61917STeresa Johnsondeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 38*e5a61917STeresa Johnson 39*e5a61917STeresa Johnsonattributes #0 = { nounwind readnone uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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" } 40*e5a61917STeresa Johnsonattributes #1 = { nounwind readnone } 41*e5a61917STeresa Johnson 42*e5a61917STeresa Johnson!llvm.dbg.cu = !{!0} 43*e5a61917STeresa Johnson!llvm.module.flags = !{!14, !15} 44*e5a61917STeresa Johnson!llvm.ident = !{!16} 45*e5a61917STeresa Johnson 46*e5a61917STeresa Johnson!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3) 47*e5a61917STeresa Johnson!1 = !DIFile(filename: "dbg.c", directory: ".") 48*e5a61917STeresa Johnson!2 = !{} 49*e5a61917STeresa Johnson!3 = !{!4, !11} 50*e5a61917STeresa Johnson!4 = distinct !DISubprogram(name: "func1", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, variables: !8) 51*e5a61917STeresa Johnson!5 = !DISubroutineType(types: !6) 52*e5a61917STeresa Johnson!6 = !{!7, !7} 53*e5a61917STeresa Johnson!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 54*e5a61917STeresa Johnson!8 = !{!9, !10} 55*e5a61917STeresa Johnson!9 = !DILocalVariable(name: "n", arg: 1, scope: !4, file: !1, line: 1, type: !7) 56*e5a61917STeresa Johnson!10 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 2, type: !7) 57*e5a61917STeresa Johnson!11 = distinct !DISubprogram(name: "func2", scope: !1, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, variables: !12) 58*e5a61917STeresa Johnson!12 = !{!13} 59*e5a61917STeresa Johnson!13 = !DILocalVariable(name: "n", arg: 1, scope: !11, file: !1, line: 8, type: !7) 60*e5a61917STeresa Johnson!14 = !{i32 2, !"Dwarf Version", i32 4} 61*e5a61917STeresa Johnson!15 = !{i32 2, !"Debug Info Version", i32 3} 62*e5a61917STeresa Johnson!16 = !{!"clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)"} 63*e5a61917STeresa Johnson!17 = !DIExpression() 64*e5a61917STeresa Johnson!18 = !DILocation(line: 1, column: 15, scope: !4) 65*e5a61917STeresa Johnson!19 = !DILocation(line: 2, column: 7, scope: !4) 66*e5a61917STeresa Johnson!20 = !DILocation(line: 3, column: 9, scope: !21) 67*e5a61917STeresa Johnson!21 = distinct !DILexicalBlock(scope: !4, file: !1, line: 3, column: 7) 68*e5a61917STeresa Johnson!22 = !DILocation(line: 3, column: 7, scope: !4) 69*e5a61917STeresa Johnson!23 = !DILocation(line: 5, column: 3, scope: !4) 70*e5a61917STeresa Johnson!24 = !DILocation(line: 8, column: 15, scope: !11) 71*e5a61917STeresa Johnson!25 = !DILocation(line: 9, column: 3, scope: !11) 72