1; Make sure Import GUID list for ThinLTO properly set for CSSPGO 2; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%S/Inputs/csspgo-import-list.prof -S | FileCheck %s 3; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/csspgo-import-list.prof -o %t.prof 4; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%t.prof -S | FileCheck %s 5; RUN: llvm-profdata show --sample -show-sec-info-only %t.prof | FileCheck %s --check-prefix=CHECK-ORDERED 6; RUN: llvm-profdata merge --sample --extbinary --use-md5 %S/Inputs/csspgo-import-list.prof -o %t.md5 7; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%t.md5 -S | FileCheck %s 8; RUN: llvm-profdata show --sample -show-sec-info-only %t.md5 | FileCheck %s --check-prefix=CHECK-ORDERED 9 10 11declare i32 @_Z5funcBi(i32 %x) 12declare i32 @_Z5funcAi(i32 %x) 13 14define dso_local i32 @main() local_unnamed_addr #0 !dbg !18 { 15entry: 16 br label %for.body, !dbg !25 17 18for.cond.cleanup: ; preds = %for.body 19 ret i32 %add3, !dbg !27 20 21for.body: ; preds = %for.body, %entry 22 %x.011 = phi i32 [ 300000, %entry ], [ %dec, %for.body ] 23 %r.010 = phi i32 [ 0, %entry ], [ %add3, %for.body ] 24 %call = tail call i32 @_Z5funcBi(i32 %x.011), !dbg !32 25 %add = add nuw nsw i32 %x.011, 1, !dbg !31 26 %call1 = tail call i32 @_Z5funcAi(i32 %add), !dbg !28 27 %add2 = add i32 %call, %r.010, !dbg !34 28 %add3 = add i32 %add2, %call1, !dbg !35 29 %dec = add nsw i32 %x.011, -1, !dbg !36 30 %cmp = icmp eq i32 %x.011, 0, !dbg !38 31 br i1 %cmp, label %for.cond.cleanup, label %for.body, !dbg !25 32} 33 34; Make sure the ImportGUID stays with entry count metadata for ThinLTO-PreLink 35; CHECK: distinct !DISubprogram(name: "main" 36; CHECK: !{!"function_entry_count", i64 3, i64 446061515086924981, i64 3815895320998406042, i64 7102633082150537521, i64 -2862076748587597320} 37 38; CHECK-ORDERED: FuncOffsetTableSection {{.*}} {ordered} 39 40attributes #0 = { nofree noinline norecurse nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" "use-sample-profile" } 41 42!llvm.dbg.cu = !{!2} 43!llvm.module.flags = !{!14, !15, !16} 44!llvm.ident = !{!17} 45 46!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 47!1 = distinct !DIGlobalVariable(name: "factor", scope: !2, file: !3, line: 21, type: !13, isLocal: false, isDefinition: true) 48!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !12, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None) 49!3 = !DIFile(filename: "merged.cpp", directory: "/local/autofdo") 50!4 = !{} 51!5 = !{!6, !10, !11} 52!6 = !DISubprogram(name: "funcA", linkageName: "_Z5funcAi", scope: !3, file: !3, line: 6, type: !7, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !4) 53!7 = !DISubroutineType(types: !8) 54!8 = !{!9, !9} 55!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 56!10 = !DISubprogram(name: "funcB", linkageName: "_Z5funcBi", scope: !3, file: !3, line: 7, type: !7, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !4) 57!11 = !DISubprogram(name: "funcLeaf", linkageName: "_Z8funcLeafi", scope: !3, file: !3, line: 22, type: !7, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !4) 58!12 = !{!0} 59!13 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !9) 60!14 = !{i32 7, !"Dwarf Version", i32 4} 61!15 = !{i32 2, !"Debug Info Version", i32 3} 62!16 = !{i32 1, !"wchar_size", i32 4} 63!17 = !{!"clang version 11.0.0"} 64!18 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 11, type: !19, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !21) 65!19 = !DISubroutineType(types: !20) 66!20 = !{!9} 67!21 = !{!22, !23} 68!22 = !DILocalVariable(name: "r", scope: !18, file: !3, line: 12, type: !9) 69!23 = !DILocalVariable(name: "x", scope: !24, file: !3, line: 13, type: !9) 70!24 = distinct !DILexicalBlock(scope: !18, file: !3, line: 13, column: 3) 71!25 = !DILocation(line: 13, column: 3, scope: !26) 72!26 = !DILexicalBlockFile(scope: !24, file: !3, discriminator: 2) 73!27 = !DILocation(line: 17, column: 3, scope: !18) 74!28 = !DILocation(line: 13, column: 10, scope: !29) 75!29 = distinct !DILexicalBlock(scope: !30, file: !3, line: 13, column: 37) 76!30 = distinct !DILexicalBlock(scope: !24, file: !3, line: 13, column: 3) 77!31 = !DILocation(line: 14, column: 29, scope: !29) 78!32 = !DILocation(line: 14, column: 21, scope: !33) 79!33 = !DILexicalBlockFile(scope: !29, file: !3, discriminator: 2) 80!34 = !DILocation(line: 14, column: 19, scope: !29) 81!35 = !DILocation(line: 14, column: 7, scope: !29) 82!36 = !DILocation(line: 13, column: 33, scope: !37) 83!37 = !DILexicalBlockFile(scope: !30, file: !3, discriminator: 6) 84!38 = !DILocation(line: 13, column: 26, scope: !39) 85!39 = !DILexicalBlockFile(scope: !30, file: !3, discriminator: 2) 86