1 ; Test to check thin link importing stats
3 ; -stats requires asserts
6 ; REQUIRES: x86-registered-target
8 ; RUN: opt -module-summary %s -o %t.bc
9 ; RUN: opt -module-summary %p/Inputs/import_stats.ll -o %t2.bc
11 ; Test thin link stats with both new and old LTO
12 ; RUN: llvm-lto -thinlto-action=run -stats %t.bc %t2.bc \
13 ; RUN: 2>&1 | FileCheck %s --check-prefix=THINLINKSTATS
14 ; RUN: llvm-lto2 run -stats -o %t3 %t.bc %t2.bc \
15 ; RUN: -r %t.bc,hot_function,plx \
16 ; RUN: -r %t.bc,hot, \
17 ; RUN: -r %t.bc,critical, \
18 ; RUN: -r %t.bc,none, \
19 ; RUN: -r %t2.bc,hot,plx \
20 ; RUN: -r %t2.bc,critical,plx \
21 ; RUN: -r %t2.bc,none,plx \
22 ; RUN: -r %t2.bc,globalvar,plx \
23 ; RUN: 2>&1 | FileCheck %s --check-prefix=THINLINKSTATS
25 ; THINLINKSTATS-DAG: 1 function-import - Number of global variables thin link decided to import
26 ; THINLINKSTATS-DAG: 1 function-import - Number of critical functions thin link decided to import
27 ; THINLINKSTATS-DAG: 3 function-import - Number of functions thin link decided to import
28 ; THINLINKSTATS-DAG: 1 function-import - Number of hot functions thin link decided to import
30 ; ModuleID = 'import_stats.ll'
31 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
32 target triple = "x86_64-unknown-linux-gnu"
34 ; This function has a high profile count, so entry block is hot.
35 define void @hot_function(i1 %a) !prof !20 {
39 br i1 %a, label %None1, label %None2, !prof !42
40 None1: ; half goes here
43 None2: ; half goes here
51 declare void @critical()
53 !42 = !{!"branch_weights", i32 1, i32 1}
55 !llvm.module.flags = !{!1}
56 !20 = !{!"function_entry_count", i64 100, i64 696010031887058302}
58 !1 = !{i32 1, !"ProfileSummary", !2}
59 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
60 !3 = !{!"ProfileFormat", !"InstrProf"}
61 !4 = !{!"TotalCount", i64 300}
62 !5 = !{!"MaxCount", i64 100}
63 !6 = !{!"MaxInternalCount", i64 100}
64 !7 = !{!"MaxFunctionCount", i64 100}
65 !8 = !{!"NumCounts", i64 4}
66 !9 = !{!"NumFunctions", i64 1}
67 !10 = !{!"DetailedSummary", !11}
68 !11 = !{!12, !13, !14}
69 !12 = !{i32 10000, i64 100, i32 1}
70 !13 = !{i32 999000, i64 100, i32 1}
71 !14 = !{i32 999999, i64 1, i32 4}