1 ;; Check if basic blocks that don't get unique sections are placed in cold sections.
2 ;; Basic block with id 1 and 2 must be in the cold section.
4 ;; Profile for version 0
5 ; RUN: echo '!_Z3bazb' > %t1
6 ; RUN: echo '!!0' >> %t1
8 ;; Profile for version 1
10 ; RUN: echo 'f _Z3bazb' >> %t2
11 ; RUN: echo 'c 0' >> %t2
13 ; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t1 -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
14 ; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t2 -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
15 ; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t1 -unique-basic-block-section-names -bbsections-cold-text-prefix=".text.unlikely." | FileCheck %s -check-prefix=LINUX-SPLIT
17 define void @_Z3bazb(i1 zeroext %0) nounwind {
18 br i1 %0, label %2, label %4
21 %3 = call i32 @_Z3barv()
25 %5 = call i32 @_Z3foov()
32 declare i32 @_Z3barv() #1
34 declare i32 @_Z3foov() #1
36 ; LINUX-SECTIONS: .section .text.hot._Z3bazb,"ax",@progbits
37 ; LINUX-SECTIONS: _Z3bazb:
38 ; Check that the basic block with id 1 doesn't get a section.
39 ; LINUX-SECTIONS-NOT: .section .text{{.*}}._Z3bazb.1,"ax",@progbits,unique
40 ; Check that a single cold section is started here and id 1 and 2 blocks are placed here.
41 ; LINUX-SECTIONS: .section .text.split._Z3bazb,"ax",@progbits
42 ; LINUX-SECTIONS: _Z3bazb.cold:
43 ; LINUX-SECTIONS-NOT: .section .text.hot._Z3bazb._Z3bazb.2,"ax",@progbits,unique
44 ; LINUX-SECTIONS: .LBB0_2:
45 ; LINUX-SECTIONS: .size _Z3bazb, .Lfunc_end{{[0-9]}}-_Z3bazb
47 ; LINUX-SPLIT: .section .text.unlikely._Z3bazb,"ax",@progbits
48 ; LINUX-SPLIT-NEXT: _Z3bazb.cold:
49 ; LINUX-SPLIT-NEXT: callq _Z3barv
50 ; LINUX-SPLIT: .LBB0_2:
51 ; LINUX-SPLIT: .LBB_END0_2: