121b1ad03SWei Mi; Check the nonflattened part of the ctxsplit profile will be read in thinlto
221b1ad03SWei Mi; postlink phase while flattened part of the ctxsplit profile will not be read.
3*3e3fc431SHongtao Yu; 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
421b1ad03SWei Mi;
521b1ad03SWei Mi; Check both the flattened and nonflattened parts of the ctxsplit profile will
621b1ad03SWei Mi; be read in thinlto prelink phase.
7*3e3fc431SHongtao Yu; 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
821b1ad03SWei Mi;
921b1ad03SWei Mi; Check both the flattened and nonflattened parts of the ctxsplit profile will
1021b1ad03SWei Mi; be read in non-thinlto mode.
11*3e3fc431SHongtao Yu; 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
1221b1ad03SWei Mi
1321b1ad03SWei Mi; POSTLINK: define dso_local i32 @goo() {{.*}} !prof ![[ENTRY1:[0-9]+]] {
1421b1ad03SWei Mi; POSTLINK: define dso_local i32 @foo() {{.*}} !prof ![[ENTRY2:[0-9]+]] {
1521b1ad03SWei Mi; POSTLINK: ![[ENTRY1]] = !{!"function_entry_count", i64 1001}
1621b1ad03SWei Mi; POSTLINK: ![[ENTRY2]] = !{!"function_entry_count", i64 -1}
1721b1ad03SWei Mi; PRELINK: define dso_local i32 @goo() {{.*}} !prof ![[ENTRY1:[0-9]+]] {
1821b1ad03SWei Mi; PRELINK: define dso_local i32 @foo() {{.*}} !prof ![[ENTRY2:[0-9]+]] {
1921b1ad03SWei Mi; PRELINK: ![[ENTRY1]] = !{!"function_entry_count", i64 1001}
2021b1ad03SWei Mi; PRELINK: ![[ENTRY2]] = !{!"function_entry_count", i64 3001}
2121b1ad03SWei Mi; NOTHINLTO: define dso_local i32 @goo() {{.*}} !prof ![[ENTRY1:[0-9]+]] {
2221b1ad03SWei Mi; NOTHINLTO: define dso_local i32 @foo() {{.*}} !prof ![[ENTRY2:[0-9]+]] {
2321b1ad03SWei Mi; NOTHINLTO: ![[ENTRY1]] = !{!"function_entry_count", i64 1001}
2421b1ad03SWei Mi; NOTHINLTO: ![[ENTRY2]] = !{!"function_entry_count", i64 3001}
2521b1ad03SWei Mi
2621b1ad03SWei Mitarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
2721b1ad03SWei Mitarget triple = "x86_64-unknown-linux-gnu"
2821b1ad03SWei Mi
2921b1ad03SWei Mi; Function Attrs: norecurse nounwind readnone uwtable
3021b1ad03SWei Midefine dso_local i32 @goo() #0 !dbg !10 {
3121b1ad03SWei Mientry:
3221b1ad03SWei Mi  ret i32 -1, !dbg !11
3321b1ad03SWei Mi}
3421b1ad03SWei Mi
3521b1ad03SWei Mi; Function Attrs: norecurse nounwind readnone uwtable
3621b1ad03SWei Midefine dso_local i32 @foo() #0 !dbg !7 {
3721b1ad03SWei Mientry:
3821b1ad03SWei Mi  ret i32 -1, !dbg !9
3921b1ad03SWei Mi}
4021b1ad03SWei Mi
4121b1ad03SWei Miattributes #0 = { "use-sample-profile" }
4221b1ad03SWei Mi
4321b1ad03SWei Mi!llvm.dbg.cu = !{!0}
4421b1ad03SWei Mi!llvm.module.flags = !{!3, !4, !5}
4521b1ad03SWei Mi!llvm.ident = !{!6}
4621b1ad03SWei Mi
4721b1ad03SWei Mi!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)
4821b1ad03SWei Mi!1 = !DIFile(filename: "a.c", directory: "")
4921b1ad03SWei Mi!2 = !{}
5021b1ad03SWei Mi!3 = !{i32 2, !"Dwarf Version", i32 4}
5121b1ad03SWei Mi!4 = !{i32 2, !"Debug Info Version", i32 3}
5221b1ad03SWei Mi!5 = !{i32 1, !"wchar_size", i32 4}
5321b1ad03SWei Mi!6 = !{!"clang version 8.0.0 (trunk 345241)"}
5421b1ad03SWei Mi!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)
5521b1ad03SWei Mi!8 = !DISubroutineType(types: !2)
5621b1ad03SWei Mi!9 = !DILocation(line: 2, column: 3, scope: !7)
5721b1ad03SWei Mi!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)
5821b1ad03SWei Mi!11 = !DILocation(line: 10, column: 3, scope: !10)
5921b1ad03SWei Mi
60