xref: /llvm-project/llvm/test/Transforms/SampleProfile/ctxsplit.ll (revision 1228becf7df28c68579f2b9b390b74aa41149a0a)
1; Check the nonflattened part of the ctxsplit profile will be read in thinlto
2; postlink phase while flattened part of the ctxsplit profile will not be read.
3; RUN: opt < %s -passes='thinlto<O2>' -pgo-kind=pgo-sample-use-pipeline -use-profiled-call-graph=0 -profile-file=%S/Inputs/ctxsplit.extbinary.afdo -S | FileCheck %s --check-prefix=POSTLINK
4;
5; Check both the flattened and nonflattened parts of the ctxsplit profile will
6; be read in thinlto prelink phase.
7; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -use-profiled-call-graph=0 -profile-file=%S/Inputs/ctxsplit.extbinary.afdo -S | FileCheck %s --check-prefix=PRELINK
8;
9; Check both the flattened and nonflattened parts of the ctxsplit profile will
10; be read in non-thinlto mode.
11; RUN: opt < %s -passes='default<O2>' -pgo-kind=pgo-sample-use-pipeline -use-profiled-call-graph=0 -profile-file=%S/Inputs/ctxsplit.extbinary.afdo -S | FileCheck %s --check-prefix=NOTHINLTO
12
13; POSTLINK: define dso_local noundef i32 @goo() {{.*}} !prof ![[ENTRY1:[0-9]+]] {
14; POSTLINK: define dso_local noundef i32 @foo() {{.*}} !prof ![[ENTRY2:[0-9]+]] {
15; POSTLINK: ![[ENTRY1]] = !{!"function_entry_count", i64 1001}
16; POSTLINK: ![[ENTRY2]] = !{!"function_entry_count", i64 -1}
17; PRELINK: define dso_local noundef i32 @goo() {{.*}} !prof ![[ENTRY1:[0-9]+]] {
18; PRELINK: define dso_local noundef i32 @foo() {{.*}} !prof ![[ENTRY2:[0-9]+]] {
19; PRELINK: ![[ENTRY1]] = !{!"function_entry_count", i64 1001}
20; PRELINK: ![[ENTRY2]] = !{!"function_entry_count", i64 3001}
21; NOTHINLTO: define dso_local noundef i32 @goo() {{.*}} !prof ![[ENTRY1:[0-9]+]] {
22; NOTHINLTO: define dso_local noundef i32 @foo() {{.*}} !prof ![[ENTRY2:[0-9]+]] {
23; NOTHINLTO: ![[ENTRY1]] = !{!"function_entry_count", i64 1001}
24; NOTHINLTO: ![[ENTRY2]] = !{!"function_entry_count", i64 3001}
25
26target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
27target triple = "x86_64-unknown-linux-gnu"
28
29; Function Attrs: norecurse nounwind readnone uwtable
30define dso_local i32 @goo() #0 !dbg !10 {
31entry:
32  ret i32 -1, !dbg !11
33}
34
35; Function Attrs: norecurse nounwind readnone uwtable
36define dso_local i32 @foo() #0 !dbg !7 {
37entry:
38  ret i32 -1, !dbg !9
39}
40
41attributes #0 = { "use-sample-profile" }
42
43!llvm.dbg.cu = !{!0}
44!llvm.module.flags = !{!3, !4, !5}
45!llvm.ident = !{!6}
46
47!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.0 (trunk 345241)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, nameTableKind: None)
48!1 = !DIFile(filename: "a.c", directory: "")
49!2 = !{}
50!3 = !{i32 2, !"Dwarf Version", i32 4}
51!4 = !{i32 2, !"Debug Info Version", i32 3}
52!5 = !{i32 1, !"wchar_size", i32 4}
53!6 = !{!"clang version 8.0.0 (trunk 345241)"}
54!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2)
55!8 = !DISubroutineType(types: !2)
56!9 = !DILocation(line: 2, column: 3, scope: !7)
57!10 = distinct !DISubprogram(name: "goo", scope: !1, file: !1, line: 8, type: !8, isLocal: false, isDefinition: true, scopeLine: 8, isOptimized: true, unit: !0, retainedNodes: !2)
58!11 = !DILocation(line: 10, column: 3, scope: !10)
59
60