| 1 |
; Generate summary sections |
| 2 |
; RUN: opt -module-summary %s -o %t1.o |
| 3 |
; RUN: opt -module-summary %p/Inputs/thinlto_cspgo_bar.ll -o %t2.o |
| 4 |
; RUN: llvm-profdata merge -o %t.profdata %p/Inputs/cspgo.proftext |
| 5 |
|
| 6 |
; RUN: rm -f %t1.o.4.opt.bc |
| 7 |
; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 8 |
; RUN: -m elf_x86_64 \ |
| 9 |
; RUN: --plugin-opt=thinlto \ |
| 10 |
; RUN: --plugin-opt=save-temps \ |
| 11 |
; RUN: --plugin-opt=cs-profile-path=%t.profdata \ |
| 12 |
; RUN: --plugin-opt=jobs=1 \ |
| 13 |
; RUN: %t1.o %t2.o -o %t3 |
| 14 |
; RUN: opt -S %t2.o.4.opt.bc | FileCheck %s |
| 15 |
|
| 16 |
source_filename = "cspgo.c" |
| 17 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 18 |
target triple = "x86_64-unknown-linux-gnu" |
| 19 |
|
| 20 |
; CHECK: CSProfileSummary |
| 21 |
|
| 22 |
define dso_local void @foo() #0 !prof !29 { |
| 23 |
entry: |
| 24 |
br label %for.body |
| 25 |
|
| 26 |
for.body: |
| 27 |
%i.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ] |
| 28 |
tail call void @bar(i32 %i.06) |
| 29 |
%add = or i32 %i.06, 1 |
| 30 |
tail call void @bar(i32 %add) |
| 31 |
%add1 = add nuw nsw i32 %i.06, 2 |
| 32 |
%cmp = icmp ult i32 %add1, 200000 |
| 33 |
br i1 %cmp, label %for.body, label %for.end, !prof !30 |
| 34 |
|
| 35 |
for.end: |
| 36 |
ret void |
| 37 |
} |
| 38 |
|
| 39 |
declare dso_local void @bar(i32) |
| 40 |
|
| 41 |
define i32 @main() !prof !29 { |
| 42 |
entry: |
| 43 |
tail call void @foo() |
| 44 |
ret i32 0 |
| 45 |
} |
| 46 |
|
| 47 |
attributes #0 = { "target-cpu"="x86-64" } |
| 48 |
|
| 49 |
!llvm.module.flags = !{!0, !1} |
| 50 |
|
| 51 |
!0 = !{i32 1, !"wchar_size", i32 4} |
| 52 |
!1 = !{i32 1, !"ProfileSummary", !2} |
| 53 |
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} |
| 54 |
!3 = !{!"ProfileFormat", !"InstrProf"} |
| 55 |
!4 = !{!"TotalCount", i64 1700001} |
| 56 |
!5 = !{!"MaxCount", i64 800000} |
| 57 |
!6 = !{!"MaxInternalCount", i64 399999} |
| 58 |
!7 = !{!"MaxFunctionCount", i64 800000} |
| 59 |
!8 = !{!"NumCounts", i64 8} |
| 60 |
!9 = !{!"NumFunctions", i64 4} |
| 61 |
!10 = !{!"DetailedSummary", !11} |
| 62 |
!11 = !{!12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27} |
| 63 |
!12 = !{i32 10000, i64 800000, i32 1} |
| 64 |
!13 = !{i32 100000, i64 800000, i32 1} |
| 65 |
!14 = !{i32 200000, i64 800000, i32 1} |
| 66 |
!15 = !{i32 300000, i64 800000, i32 1} |
| 67 |
!16 = !{i32 400000, i64 800000, i32 1} |
| 68 |
!17 = !{i32 500000, i64 399999, i32 2} |
| 69 |
!18 = !{i32 600000, i64 399999, i32 2} |
| 70 |
!19 = !{i32 700000, i64 399999, i32 2} |
| 71 |
!20 = !{i32 800000, i64 200000, i32 3} |
| 72 |
!21 = !{i32 900000, i64 100000, i32 6} |
| 73 |
!22 = !{i32 950000, i64 100000, i32 6} |
| 74 |
!23 = !{i32 990000, i64 100000, i32 6} |
| 75 |
!24 = !{i32 999000, i64 100000, i32 6} |
| 76 |
!25 = !{i32 999900, i64 100000, i32 6} |
| 77 |
!26 = !{i32 999990, i64 100000, i32 6} |
| 78 |
!27 = !{i32 999999, i64 100000, i32 6} |
| 79 |
!29 = !{!"function_entry_count", i64 1} |
| 80 |
!30 = !{!"branch_weights", i32 100000, i32 1} |