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