llvm.org GIT mirror llvm / c99ec63
[LTO] llvm-lto2: Add option to load sample profile Summary: This exposes LTO's Conf.SampleProfile as a command line option (-lto-sample-profile-file) for testing via the llvm-lto2 utility. Reviewers: pcc, danielcdh Subscribers: mehdi_amini, inglorion, llvm-commits Differential Revision: https://reviews.llvm.org/D36030 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309456 91177308-0d34-0410-b5e6-96231b3b80d8 Tobias Edler von Koch 3 years ago
3 changed file(s) with 45 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; Test that llvm-lto2 handles the -lto-sample-profile-file option
1 ;
2 ; RUN: opt -module-summary < %s -o %t.bc
3 ; RUN: llvm-lto2 run -o %t.out %t.bc -save-temps \
4 ; RUN: -r %t.bc,foo,px -r %t.bc,bar,x \
5 ; RUN: -lto-sample-profile-file=%S/Inputs/load-sample-prof.prof
6 ; RUN: llvm-dis %t.out.0.4.opt.bc -o - | FileCheck %s
7 ;
8 ; CHECK: !prof
9
10 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
11 target triple = "x86_64-unknown-linux-gnu"
12
13 define void @foo() local_unnamed_addr !dbg !7 {
14 entry:
15 tail call void @bar(), !dbg !10
16 ret void, !dbg !11
17 }
18
19 declare void @bar() local_unnamed_addr
20
21 !llvm.dbg.cu = !{!0}
22 !llvm.module.flags = !{!3, !4, !5}
23 !llvm.ident = !{!6}
24
25 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
26 !1 = !DIFile(filename: "test.c", directory: "/tmp")
27 !2 = !{}
28 !3 = !{i32 2, !"Dwarf Version", i32 4}
29 !4 = !{i32 2, !"Debug Info Version", i32 3}
30 !5 = !{i32 1, !"wchar_size", i32 4}
31 !6 = !{!"clang version 6.0.0 "}
32 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, variables: !2)
33 !8 = !DISubroutineType(types: !9)
34 !9 = !{null}
35 !10 = !DILocation(line: 4, column: 5, scope: !7)
36 !11 = !DILocation(line: 5, column: 1, scope: !7)
9898 "pass-remarks-with-hotness",
9999 cl::desc("Whether to include hotness informations in the remarks.\n"
100100 "Has effect only if -pass-remarks-output is specified."));
101
102 static cl::opt
103 SamplePGOFile("lto-sample-profile-file",
104 cl::desc("Specify a SamplePGO profile file"));
101105
102106 static cl::opt
103107 UseNewPM("use-new-pm",
197201 // Optimization remarks.
198202 Conf.RemarksFilename = OptRemarksOutput;
199203 Conf.RemarksWithHotness = OptRemarksWithHotness;
204
205 Conf.SampleProfile = SamplePGOFile;
200206
201207 // Run a custom pipeline, if asked for.
202208 Conf.OptPipeline = OptPipeline;