51 lines · plain
1; Do setup work for all below tests: generate bitcode and combined index2; RUN: opt -module-summary %s -o %t.bc3; RUN: opt -module-summary %p/Inputs/funcimport_debug.ll -o %t2.bc4; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc5 6; Do the import now and confirm that metadata is linked for imported function.7; RUN: opt -passes=function-import -summary-file %t3.thinlto.bc %t.bc -S | FileCheck %s8 9; CHECK: define available_externally void @func()10 11; Check that we have exactly two subprograms (that func's subprogram wasn't12; linked more than once for example), and that they are connected to13; the correct compile unit.14; CHECK: ![[CU1:[0-9]+]] = distinct !DICompileUnit(15; CHECK: ![[CU2:[0-9]+]] = distinct !DICompileUnit(16; CHECK: distinct !DISubprogram(name: "main"17; CHECK-SAME: unit: ![[CU1]]18; CHECK: distinct !DISubprogram(name: "func"19; CHECK-SAME: unit: ![[CU2]]20; CHECK-NOT: distinct !DISubprogram21 22; ModuleID = 'funcimport_debug.o'23target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"24target triple = "x86_64-unknown-linux-gnu"25 26; Function Attrs: nounwind uwtable27define i32 @main() !dbg !4 {28entry:29 call void (...) @func(), !dbg !1130 ret i32 0, !dbg !1231}32 33declare void @func(...)34 35!llvm.dbg.cu = !{!0}36!llvm.module.flags = !{!8, !9}37!llvm.ident = !{!10}38 39!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)40!1 = !DIFile(filename: "funcimport_debug.c", directory: ".")41!2 = !{}42!4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !2)43!5 = !DISubroutineType(types: !6)44!6 = !{!7}45!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)46!8 = !{i32 2, !"Dwarf Version", i32 4}47!9 = !{i32 2, !"Debug Info Version", i32 3}48!10 = !{!"clang version 3.8.0 (trunk 255685) (llvm/trunk 255682)"}49!11 = !DILocation(line: 3, column: 3, scope: !4)50!12 = !DILocation(line: 4, column: 1, scope: !4)51