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