File: hotness_based_import2.ll

package info (click to toggle)
llvm-toolchain-4.0 1%3A4.0.1-10~deb9u2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 493,332 kB
  • sloc: cpp: 2,698,100; ansic: 552,773; asm: 128,821; python: 121,589; objc: 105,054; sh: 21,174; lisp: 6,758; ml: 5,532; perl: 5,311; pascal: 5,245; makefile: 2,083; cs: 1,868; xml: 686; php: 212; csh: 117
file content (53 lines) | stat: -rw-r--r-- 1,962 bytes parent folder | download | duplicates (2)
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
; Test to check that callee reached from cold and then hot path gets
; hot thresholds.
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/hotness_based_import2.ll -o %t2.bc
; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc

; Teset with limit set to 10 and multipliers set to 1. Since cold call to
; hot is first in the other module, we'll first add calledFromHot to worklist
; with threshold decayed by default 0.7 factor. Test ensures that when we
; encounter it again from hot path, we re-enqueue with higher non-decayed
; threshold which will allow it to be imported.
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=10 -import-hot-multiplier=1.0 -import-cold-multiplier=1.0 -S | FileCheck %s --check-prefix=CHECK
; CHECK-DAG: define available_externally void @hot()
; CHECK-DAG: define available_externally void @calledFromHot()

; ModuleID = 'thinlto-function-summary-callgraph.ll'
target datalayout = "e-m:e-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, i1 %a2) !prof !28 {
entry:
  call void @hot()
  ret void
}

; This function has a low profile count, so entry block is hot.
define void @cold_function(i1 %a, i1 %a2) !prof !29 {
entry:
  call void @hot()
  ret void
}

declare void @hot() #1

!llvm.module.flags = !{!1}

!1 = !{i32 1, !"ProfileSummary", !2}
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
!3 = !{!"ProfileFormat", !"InstrProf"}
!4 = !{!"TotalCount", i64 222}
!5 = !{!"MaxCount", i64 110}
!6 = !{!"MaxInternalCount", i64 1}
!7 = !{!"MaxFunctionCount", i64 110}
!8 = !{!"NumCounts", i64 4}
!9 = !{!"NumFunctions", i64 3}
!10 = !{!"DetailedSummary", !11}
!11 = !{!12, !13, !14}
!12 = !{i32 10000, i64 110, i32 2}
!13 = !{i32 999000, i64 2, i32 4}
!14 = !{i32 999999, i64 2, i32 4}
!28 = !{!"function_entry_count", i64 110}
!29 = !{!"function_entry_count", i64 1}