File: import_stats.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (71 lines) | stat: -rw-r--r-- 2,383 bytes parent folder | download | duplicates (21)
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}