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.
3; RUN: echo '!_Z3bazb' > %t
4; RUN: echo '!!0' >> %t
5; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
6; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t -unique-basic-block-section-names -bbsections-cold-text-prefix=".text.unlikely." | FileCheck %s -check-prefix=LINUX-SPLIT
7
8define void @_Z3bazb(i1 zeroext %0) nounwind {
9  br i1 %0, label %2, label %4
10
112:                                                ; preds = %1
12  %3 = call i32 @_Z3barv()
13  br label %6
14
154:                                                ; preds = %1
16  %5 = call i32 @_Z3foov()
17  br label %6
18
196:                                                ; preds = %2, %4
20  ret void
21}
22
23declare i32 @_Z3barv() #1
24
25declare i32 @_Z3foov() #1
26
27; LINUX-SECTIONS: .section        .text._Z3bazb,"ax",@progbits
28; LINUX-SECTIONS: _Z3bazb:
29; Check that the basic block with id 1 doesn't get a section.
30; LINUX-SECTIONS-NOT: .section        .text._Z3bazb._Z3bazb.1,"ax",@progbits,unique
31; Check that a single cold section is started here and id 1 and 2 blocks are placed here.
32; LINUX-SECTIONS: .section	.text.split._Z3bazb,"ax",@progbits
33; LINUX-SECTIONS: _Z3bazb.cold:
34; LINUX-SECTIONS-NOT: .section        .text._Z3bazb._Z3bazb.2,"ax",@progbits,unique
35; LINUX-SECTIONS: .LBB0_2:
36; LINUX-SECTIONS: .size   _Z3bazb, .Lfunc_end{{[0-9]}}-_Z3bazb
37
38; LINUX-SPLIT:      .section	.text.unlikely._Z3bazb,"ax",@progbits
39; LINUX-SPLIT-NEXT: _Z3bazb.cold:
40; LINUX-SPLIT-NEXT:   callq _Z3barv
41; LINUX-SPLIT:      .LBB0_2:
42; LINUX-SPLIT:      .LBB_END0_2:
43