1 ; Check the basic block sections labels option
2 ; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels | FileCheck %s --check-prefixes=CHECK,BASIC
4 ;; Also verify this holds for all PGO features enabled
5 ; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -pgo-analysis-map=func-entry-count,bb-freq,br-prob | FileCheck %s --check-prefixes=CHECK,PGO-ALL,PGO-FEC,PGO-BBF,PGO-BRP
7 ;; Also verify that pgo extension only includes the enabled feature
8 ; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -pgo-analysis-map=func-entry-count | FileCheck %s --check-prefixes=CHECK,PGO-FEC,FEC-ONLY
9 ; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -pgo-analysis-map=bb-freq | FileCheck %s --check-prefixes=CHECK,PGO-BBF,BBF-ONLY
10 ; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -pgo-analysis-map=br-prob | FileCheck %s --check-prefixes=CHECK,PGO-BRP,BRP-ONLY
13 define void @_Z3bazb(i1 zeroext, i1 zeroext) personality ptr @__gxx_personality_v0 !prof !0 {
14 br i1 %0, label %3, label %8, !prof !1
17 %4 = invoke i32 @_Z3barv()
18 to label %8 unwind label %6
22 landingpad { ptr, i32 }
27 %9 = call i32 @_Z3foov()
28 br i1 %1, label %12, label %10, !prof !2
31 %11 = select i1 %1, ptr blockaddress(@_Z3bazb, %3), ptr blockaddress(@_Z3bazb, %12) ; <ptr> [#uses=1]
32 indirectbr ptr %11, [label %3, label %12], !prof !3
38 declare i32 @_Z3barv() #1
40 declare i32 @_Z3foov() #1
42 declare i32 @__gxx_personality_v0(...)
44 !0 = !{!"function_entry_count", i64 100}
45 !1 = !{!"branch_weights", i32 80, i32 20}
46 !2 = !{!"branch_weights", i32 70, i32 10}
47 !3 = !{!"branch_weights", i32 15, i32 5}
49 ; CHECK: .section .text._Z3bazb,"ax",@progbits{{$}}
50 ; CHECK-LABEL: _Z3bazb:
51 ; CHECK-LABEL: .Lfunc_begin0:
52 ; CHECK-LABEL: .LBB_END0_0:
53 ; CHECK-LABEL: .LBB0_1:
54 ; CHECK-LABEL: .LBB_END0_1:
55 ; CHECK-LABEL: .LBB0_2:
56 ; CHECK-LABEL: .LBB_END0_2:
57 ; CHECK-LABEL: .LBB0_3:
58 ; CHECK-LABEL: .LBB_END0_3:
59 ; CHECK-LABEL: .Lfunc_end0:
61 ; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text._Z3bazb{{$}}
62 ; CHECK-NEXT: .byte 2 # version
63 ; BASIC-NEXT: .byte 0 # feature
64 ; PGO-ALL-NEXT: .byte 7 # feature
65 ; FEC-ONLY-NEXT:.byte 1 # feature
66 ; BBF-ONLY-NEXT:.byte 2 # feature
67 ; BRP-ONLY-NEXT:.byte 4 # feature
68 ; CHECK-NEXT: .quad .Lfunc_begin0 # function address
69 ; CHECK-NEXT: .byte 6 # number of basic blocks
70 ; CHECK-NEXT: .byte 0 # BB id
71 ; CHECK-NEXT: .uleb128 .Lfunc_begin0-.Lfunc_begin0
72 ; CHECK-NEXT: .uleb128 .LBB_END0_0-.Lfunc_begin0
74 ; CHECK-NEXT: .byte 1 # BB id
75 ; CHECK-NEXT: .uleb128 .LBB0_1-.LBB_END0_0
76 ; CHECK-NEXT: .uleb128 .LBB_END0_1-.LBB0_1
78 ; CHECK-NEXT: .byte 3 # BB id
79 ; CHECK-NEXT: .uleb128 .LBB0_2-.LBB_END0_1
80 ; CHECK-NEXT: .uleb128 .LBB_END0_2-.LBB0_2
82 ; CHECK-NEXT: .byte 5 # BB id
83 ; CHECK-NEXT: .uleb128 .LBB0_3-.LBB_END0_2
84 ; CHECK-NEXT: .uleb128 .LBB_END0_3-.LBB0_3
86 ; CHECK-NEXT: .byte 4 # BB id
87 ; CHECK-NEXT: .uleb128 .LBB0_4-.LBB_END0_3
88 ; CHECK-NEXT: .uleb128 .LBB_END0_4-.LBB0_4
89 ; CHECK-NEXT: .byte 16
90 ; CHECK-NEXT: .byte 2 # BB id
91 ; CHECK-NEXT: .uleb128 .LBB0_5-.LBB_END0_4
92 ; CHECK-NEXT: .uleb128 .LBB_END0_5-.LBB0_5
96 ; PGO-FEC-NEXT: .byte 100 # function entry count
97 ; PGO-BBF-NEXT: .ascii "\271\235\376\332\245\200\356\017" # basic block frequency
98 ; PGO-BRP-NEXT: .byte 2 # basic block successor count
99 ; PGO-BRP-NEXT: .byte 1 # successor BB ID
100 ; PGO-BRP-NEXT: .ascii "\346\314\231\263\006" # successor branch probability
101 ; PGO-BRP-NEXT: .byte 3 # successor BB ID
102 ; PGO-BRP-NEXT: .ascii "\232\263\346\314\001" # successor branch probability
103 ; PGO-BBF-NEXT: .ascii "\202\301\341\375\205\200\200\003" # basic block frequency
104 ; PGO-BRP-NEXT: .byte 2 # basic block successor count
105 ; PGO-BRP-NEXT: .byte 3 # successor BB ID
106 ; PGO-BRP-NEXT: .ascii "\200\360\377\377\007" # successor branch probability
107 ; PGO-BRP-NEXT: .byte 2 # successor BB ID
108 ; PGO-BRP-NEXT: .ascii "\200\020" # successor branch probability
109 ; PGO-BBF-NEXT: .ascii "\200\200\200\200\200\200\200 " # basic block frequency
110 ; PGO-BRP-NEXT: .byte 2 # basic block successor count
111 ; PGO-BRP-NEXT: .byte 5 # successor BB ID
112 ; PGO-BRP-NEXT: .ascii "\200\200\200\200\007" # successor branch probability
113 ; PGO-BRP-NEXT: .byte 4 # successor BB ID
114 ; PGO-BRP-NEXT: .ascii "\200\200\200\200\001" # successor branch probability
115 ; PGO-BBF-NEXT: .ascii "\271\235\376\332\245\200\356\017" # basic block frequency
116 ; PGO-BRP-NEXT: .byte 0 # basic block successor count
117 ; PGO-BBF-NEXT: .ascii "\210\214\356\257\200\200\230\002" # basic block frequency
118 ; PGO-BRP-NEXT: .byte 2 # basic block successor count
119 ; PGO-BRP-NEXT: .byte 1 # successor BB ID
120 ; PGO-BRP-NEXT: .ascii "\200\200\200\200\006" # successor branch probability
121 ; PGO-BRP-NEXT: .byte 5 # successor BB ID
122 ; PGO-BRP-NEXT: .ascii "\200\200\200\200\002" # successor branch probability
123 ; PGO-BBF-NEXT: .ascii "\235\323\243\200#" # basic block frequency
124 ; PGO-BRP-NEXT: .byte 1 # basic block successor count
125 ; PGO-BRP-NEXT: .byte 5 # successor BB ID
126 ; PGO-BRP-NEXT: .ascii "\200\200\200\200\b" # successor branch probability