1; REQUIRES: x86-registered-target 2 3; RUN: opt -module-summary %s -o %t1.bc 4; RUN: opt -module-summary %S/Inputs/thinlto_cspgo_bar_use.ll -o %t2.bc 5; RUN: llvm-profdata merge %S/Inputs/thinlto_cs.proftext -o %t3.profdata 6; RUN: llvm-lto2 run -lto-cspgo-profile-file=%t3.profdata -pgo-instrument-entry=false -save-temps -o %t %t1.bc %t2.bc \ 7; RUN: -r=%t1.bc,foo,pl \ 8; RUN: -r=%t1.bc,bar,l \ 9; RUN: -r=%t1.bc,main,plx \ 10; RUN: -r=%t2.bc,bar,pl \ 11; RUN: -r=%t2.bc,clobber,pl \ 12; RUN: -r=%t2.bc,odd,pl \ 13; RUN: -r=%t2.bc,even,pl 14; RUN: llvm-dis %t.1.4.opt.bc -o - | FileCheck %s --check-prefix=CSUSE 15 16; CSUSE: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}} 17; CSUSE: {{![0-9]+}} = !{i32 1, !"CSProfileSummary", {{![0-9]+}}} 18; CSUSE-DAG: {{![0-9]+}} = !{!"branch_weights", i32 100000, i32 0} 19; CSUSE-DAG: {{![0-9]+}} = !{!"branch_weights", i32 0, i32 100000} 20 21source_filename = "cspgo.c" 22target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 23target triple = "x86_64-unknown-linux-gnu" 24 25define dso_local void @foo() #0 !prof !29 { 26entry: 27 br label %for.body 28 29for.body: 30 %i.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ] 31 tail call void @bar(i32 %i.06) 32 %add = or i32 %i.06, 1 33 tail call void @bar(i32 %add) 34 %add1 = add nuw nsw i32 %i.06, 2 35 %cmp = icmp ult i32 %add1, 200000 36 br i1 %cmp, label %for.body, label %for.end, !prof !30 37 38for.end: 39 ret void 40} 41 42declare dso_local void @bar(i32) 43 44define dso_local i32 @main() !prof !29 { 45entry: 46 tail call void @foo() 47 ret i32 0 48} 49 50attributes #0 = { "target-cpu"="x86-64" } 51 52!llvm.module.flags = !{!0, !1} 53 54!0 = !{i32 1, !"wchar_size", i32 4} 55!1 = !{i32 1, !"ProfileSummary", !2} 56!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} 57!3 = !{!"ProfileFormat", !"InstrProf"} 58!4 = !{!"TotalCount", i64 500002} 59!5 = !{!"MaxCount", i64 200000} 60!6 = !{!"MaxInternalCount", i64 100000} 61!7 = !{!"MaxFunctionCount", i64 200000} 62!8 = !{!"NumCounts", i64 6} 63!9 = !{!"NumFunctions", i64 4} 64!10 = !{!"DetailedSummary", !11} 65!11 = !{!12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27} 66!12 = !{i32 10000, i64 200000, i32 1} 67!13 = !{i32 100000, i64 200000, i32 1} 68!14 = !{i32 200000, i64 200000, i32 1} 69!15 = !{i32 300000, i64 200000, i32 1} 70!16 = !{i32 400000, i64 200000, i32 1} 71!17 = !{i32 500000, i64 100000, i32 4} 72!18 = !{i32 600000, i64 100000, i32 4} 73!19 = !{i32 700000, i64 100000, i32 4} 74!20 = !{i32 800000, i64 100000, i32 4} 75!21 = !{i32 900000, i64 100000, i32 4} 76!22 = !{i32 950000, i64 100000, i32 4} 77!23 = !{i32 990000, i64 100000, i32 4} 78!24 = !{i32 999000, i64 100000, i32 4} 79!25 = !{i32 999900, i64 100000, i32 4} 80!26 = !{i32 999990, i64 100000, i32 4} 81!27 = !{i32 999999, i64 1, i32 6} 82!29 = !{!"function_entry_count", i64 1} 83!30 = !{!"branch_weights", i32 100000, i32 1} 84