xref: /llvm-project/llvm/test/LTO/Resolution/X86/load-sample-prof-icp.ll (revision 15655915b38600c28f58721950ae75e6284763b6)
1; Test that llvm-lto2 handles the -lto-sample-profile-file option and pass
2; down to the ICP correctly.
3;
4; RUN: opt -module-summary < %s -o %t.bc
5; RUN: llvm-lto2 run -o %t.out %t.bc -save-temps \
6; RUN:   -r %t.bc,test,px -r %t.bc,bar,px -r %t.bc,externfunc,x \
7; RUN:   -lto-sample-profile-file=%S/Inputs/load-sample-prof-icp.prof
8; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s
9
10target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
11target triple = "x86_64-unknown-linux-gnu"
12
13; CHECK-LABEL: @test
14; Checks that the call instruction is promoted to direct call and has
15; profile count annotated on the direct call.
16define void @test(ptr) #0 !dbg !7 {
17  %2 = alloca ptr
18  store ptr %0, ptr %2
19  %3 = load ptr, ptr %2
20  ; CHECK: call void @bar(),{{.*}}!prof
21  call void %3(), !dbg !10
22  ret void
23}
24
25declare void @externfunc()
26
27define void @bar() #0 {
28  call void @externfunc()
29  ret void
30}
31
32attributes #0 = {"use-sample-profile" noinline}
33
34!llvm.dbg.cu = !{!0}
35!llvm.module.flags = !{!3, !4, !5}
36!llvm.ident = !{!6}
37
38!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
39!1 = !DIFile(filename: "test.c", directory: "/tmp")
40!2 = !{}
41!3 = !{i32 2, !"Dwarf Version", i32 4}
42!4 = !{i32 2, !"Debug Info Version", i32 3}
43!5 = !{i32 1, !"wchar_size", i32 4}
44!6 = !{!"clang version 6.0.0 "}
45!7 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, retainedNodes: !2)
46!8 = !DISubroutineType(types: !9)
47!9 = !{null}
48!10 = !DILocation(line: 4, column: 5, scope: !7)
49!11 = !DILocation(line: 5, column: 1, scope: !7)
50