1; Check flattened profile will not be read in thinlto postlink.
2; RUN: opt < %s -O2 -flattened-profile-used -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/flattened.prof -enable-chr=false -perform-thinlto=true -enable-new-pm=0 -S | FileCheck %s
3; RUN: opt < %s -passes='thinlto<O2>' -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/flattened.prof -flattened-profile-used -S | FileCheck %s
4;
5; Check flattened profile will be read in thinlto prelink.
6; RUN: opt < %s -O2 -flattened-profile-used -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/flattened.prof -enable-chr=false -prepare-for-thinlto=true -enable-new-pm=0 -S | FileCheck %s --check-prefix=PRELINK
7; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/flattened.prof -flattened-profile-used -S | FileCheck %s --check-prefix=PRELINK
8;
9; Check flattened profile will be read in non-thinlto mode.
10; RUN: opt < %s -O2 -flattened-profile-used -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/flattened.prof -enable-chr=false -enable-new-pm=0 -S | FileCheck %s --check-prefix=NOTHINLTO
11; RUN: opt < %s -passes='default<O2>' -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/flattened.prof -flattened-profile-used -S | FileCheck %s --check-prefix=NOTHINLTO
12;
13; CHECK-NOT: !{!"ProfileFormat", !"SampleProfile"}
14; PRELINK:   !{!"ProfileFormat", !"SampleProfile"}
15; NOTHINLTO: !{!"ProfileFormat", !"SampleProfile"}
16
17target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
18target triple = "x86_64-unknown-linux-gnu"
19
20; Function Attrs: norecurse nounwind readnone uwtable
21define dso_local i32 @foo() local_unnamed_addr !dbg !7 {
22entry:
23  ret i32 -1, !dbg !9
24}
25
26!llvm.dbg.cu = !{!0}
27!llvm.module.flags = !{!3, !4, !5}
28!llvm.ident = !{!6}
29
30!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)
31!1 = !DIFile(filename: "a.c", directory: "")
32!2 = !{}
33!3 = !{i32 2, !"Dwarf Version", i32 4}
34!4 = !{i32 2, !"Debug Info Version", i32 3}
35!5 = !{i32 1, !"wchar_size", i32 4}
36!6 = !{!"clang version 8.0.0 (trunk 345241)"}
37!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)
38!8 = !DISubroutineType(types: !2)
39!9 = !DILocation(line: 2, column: 3, scope: !7)
40