File: basic-block-address-map-pgo-features.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (147 lines) | stat: -rw-r--r-- 7,394 bytes parent folder | download | duplicates (3)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
; Check the basic block sections labels option
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map | FileCheck %s --check-prefixes=CHECK,BASIC,PGO-NONE
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=none | FileCheck %s --check-prefixes=CHECK,BASIC,PGO-NONE

;; Also verify this holds for all PGO features enabled
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=func-entry-count,bb-freq,br-prob | FileCheck %s --check-prefixes=CHECK,PGO-ALL,PGO-FEC,PGO-BBF,PGO-BRP
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=all | FileCheck %s --check-prefixes=CHECK,PGO-ALL,PGO-FEC,PGO-BBF,PGO-BRP

;; Also verify that pgo extension only includes the enabled feature
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=func-entry-count | FileCheck %s --check-prefixes=CHECK,PGO-FEC,FEC-ONLY
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=bb-freq | FileCheck %s --check-prefixes=CHECK,PGO-BBF,BBF-ONLY
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=br-prob | FileCheck %s --check-prefixes=CHECK,PGO-BRP,BRP-ONLY

; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=func-entry-count -basic-block-address-map-skip-bb-entries | FileCheck %s --check-prefixes=SKIP-BB-ENTRIES
; RUN: not llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=bb-freq -basic-block-address-map-skip-bb-entries 2>&1 | FileCheck %s --check-prefixes=SKIP-BB-ENTRIES-ERROR
; RUN: not llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=br-prob -basic-block-address-map-skip-bb-entries 2>&1 | FileCheck %s --check-prefixes=SKIP-BB-ENTRIES-ERROR

;; Verify that we emit an error if we try and specify values in addition to all/none
; RUN: not llc < %s -mtriple=x86_64 -basic-block-address-map -pgo-analysis-map=all,bb-freq
; RUN: not llc < %s -mtriple=x86_64 -basic-block-address-map -pgo-analysis-map=none,bb-freq


define void @_Z3bazb(i1 zeroext, i1 zeroext) personality ptr @__gxx_personality_v0 !prof !0  {
  br i1 %0, label %3, label %8, !prof !1

3:
  %4 = invoke i32 @_Z3barv()
          to label %8 unwind label %6
  br label %10

6:
  landingpad { ptr, i32 }
          catch ptr null
  br label %12

8:
  %9 = call i32 @_Z3foov()
  br i1 %1, label %12, label %10, !prof !2

10:
  %11 = select i1 %1, ptr blockaddress(@_Z3bazb, %3), ptr blockaddress(@_Z3bazb, %12) ; <ptr> [#uses=1]
  indirectbr ptr %11, [label %3, label %12], !prof !3

12:
  ret void
}

declare i32 @_Z3barv() #1

declare i32 @_Z3foov() #1

declare i32 @__gxx_personality_v0(...)

!0 = !{!"function_entry_count", i64 100}
!1 = !{!"branch_weights", i32 80, i32 20}
!2 = !{!"branch_weights", i32 70, i32 10}
!3 = !{!"branch_weights", i32 15, i32 5}

; CHECK:	.section .text._Z3bazb,"ax",@progbits{{$}}
; CHECK-LABEL:	_Z3bazb:
; CHECK-LABEL:	.Lfunc_begin0:
; CHECK-LABEL:	.LBB_END0_0:
; CHECK-LABEL:	.LBB0_1:
; CHECK-LABEL:	.LBB_END0_1:
; CHECK-LABEL:	.LBB0_2:
; CHECK-LABEL:	.LBB_END0_2:
; CHECK-LABEL:	.LBB0_3:
; CHECK-LABEL:	.LBB_END0_3:
; CHECK-LABEL:	.Lfunc_end0:

; CHECK: 	.section	.llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text._Z3bazb{{$}}
; CHECK-NEXT:	.byte	2		# version
; BASIC-NEXT:	.byte	0		# feature
; PGO-ALL-NEXT:	.byte	7		# feature
; FEC-ONLY-NEXT:.byte	1		# feature
; BBF-ONLY-NEXT:.byte	2		# feature
; BRP-ONLY-NEXT:.byte	4		# feature
; CHECK-NEXT:	.quad	.Lfunc_begin0	# function address
; CHECK-NEXT:	.byte	6		# number of basic blocks
; CHECK-NEXT:	.byte	0		# BB id
; CHECK-NEXT:	.uleb128 .Lfunc_begin0-.Lfunc_begin0
; CHECK-NEXT:	.uleb128 .LBB_END0_0-.Lfunc_begin0
; CHECK-NEXT:	.byte	8
; CHECK-NEXT:	.byte	1		# BB id
; CHECK-NEXT:	.uleb128 .LBB0_1-.LBB_END0_0
; CHECK-NEXT:	.uleb128 .LBB_END0_1-.LBB0_1
; CHECK-NEXT:	.byte	8
; CHECK-NEXT:	.byte	3		# BB id
; CHECK-NEXT:	.uleb128 .LBB0_2-.LBB_END0_1
; CHECK-NEXT:	.uleb128 .LBB_END0_2-.LBB0_2
; CHECK-NEXT:	.byte	8
; CHECK-NEXT:	.byte	5		# BB id
; CHECK-NEXT:	.uleb128 .LBB0_3-.LBB_END0_2
; CHECK-NEXT:	.uleb128 .LBB_END0_3-.LBB0_3
; CHECK-NEXT:	.byte	1
; CHECK-NEXT:	.byte	4		# BB id
; CHECK-NEXT:	.uleb128 .LBB0_4-.LBB_END0_3
; CHECK-NEXT:	.uleb128 .LBB_END0_4-.LBB0_4
; CHECK-NEXT:	.byte	16
; CHECK-NEXT:	.byte	2		# BB id
; CHECK-NEXT:	.uleb128 .LBB0_5-.LBB_END0_4
; CHECK-NEXT:	.uleb128 .LBB_END0_5-.LBB0_5
; CHECK-NEXT:	.byte	4

;; PGO Analysis Map
; PGO-NONE-NOT: .byte	100		# function entry count
; PGO-NONE-NOT: .ascii	"\271\235\376\332\245\200\356\017"	# basic block frequency
; PGO-NONE-NOT: .byte	2		# basic block successor count
; PGO-FEC-NEXT:	.byte	100		# function entry count
; PGO-BBF-NEXT:	.ascii	"\271\235\376\332\245\200\356\017"	# basic block frequency
; PGO-BRP-NEXT:	.byte	2		# basic block successor count
; PGO-BRP-NEXT:	.byte	1		# successor BB ID
; PGO-BRP-NEXT:	.ascii	"\346\314\231\263\006"	# successor branch probability
; PGO-BRP-NEXT:	.byte	3		# successor BB ID
; PGO-BRP-NEXT:	.ascii	"\232\263\346\314\001"	# successor branch probability
; PGO-BBF-NEXT:	.ascii	"\202\301\341\375\205\200\200\003"	# basic block frequency
; PGO-BRP-NEXT:	.byte	2		# basic block successor count
; PGO-BRP-NEXT:	.byte	3		# successor BB ID
; PGO-BRP-NEXT:	.ascii	"\200\360\377\377\007"	# successor branch probability
; PGO-BRP-NEXT:	.byte	2		# successor BB ID
; PGO-BRP-NEXT:	.ascii	"\200\020"	# successor branch probability
; PGO-BBF-NEXT:	.ascii	"\200\200\200\200\200\200\200 "	# basic block frequency
; PGO-BRP-NEXT:	.byte	2		# basic block successor count
; PGO-BRP-NEXT:	.byte	5		# successor BB ID
; PGO-BRP-NEXT:	.ascii	"\200\200\200\200\007"	# successor branch probability
; PGO-BRP-NEXT:	.byte 	4		# successor BB ID
; PGO-BRP-NEXT:	.ascii	"\200\200\200\200\001"	# successor branch probability
; PGO-BBF-NEXT:	.ascii	"\271\235\376\332\245\200\356\017"	# basic block frequency
; PGO-BRP-NEXT:	.byte	0		# basic block successor count
; PGO-BBF-NEXT:	.ascii	"\210\214\356\257\200\200\230\002"	# basic block frequency
; PGO-BRP-NEXT:	.byte	2		# basic block successor count
; PGO-BRP-NEXT:	.byte 	1		# successor BB ID
; PGO-BRP-NEXT:	.ascii	"\200\200\200\200\006"	# successor branch probability
; PGO-BRP-NEXT:	.byte	5		# successor BB ID
; PGO-BRP-NEXT:	.ascii	"\200\200\200\200\002"	# successor branch probability
; PGO-BBF-NEXT:	.ascii	"\235\323\243\200#"	# basic block frequency
; PGO-BRP-NEXT:	.byte	1		# basic block successor count
; PGO-BRP-NEXT:	.byte	5		# successor BB ID
; PGO-BRP-NEXT:	.ascii	"\200\200\200\200\b"	# successor branch probability

; SKIP-BB-ENTRIES:      .byte	17                              # feature
; SKIP-BB-ENTRIES-NEXT:	.quad	.Lfunc_begin0                   # function address
; SKIP-BB-ENTRIES-NEXT:	.byte	6                               # number of basic blocks
; SKIP-BB-ENTRIES-NEXT:	.byte	100                             # function entry count
; SKIP-BB-ENTRIES-NOT:  # BB id

; SKIP-BB-ENTRIES-ERROR: error: BB entries info is required for BBFreq and BrProb features