1; Fine-grained basic block sections, subset of basic blocks in a function.
2; Only basic block with id 2 must get a section.
3; RUN: echo '!_Z3bazb' > %t
4; RUN: echo '!!2' >> %t
5; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
6
7define void @_Z3bazb(i1 zeroext) nounwind {
8  %2 = alloca i8, align 1
9  %3 = zext i1 %0 to i8
10  store i8 %3, i8* %2, align 1
11  %4 = load i8, i8* %2, align 1
12  %5 = trunc i8 %4 to i1
13  br i1 %5, label %6, label %8
14
156:                                                ; preds = %1
16  %7 = call i32 @_Z3barv()
17  br label %10
18
198:                                                ; preds = %1
20  %9 = call i32 @_Z3foov()
21  br label %10
22
2310:                                               ; preds = %8, %6
24  ret void
25}
26
27declare i32 @_Z3barv() #1
28
29declare i32 @_Z3foov() #1
30
31; Check that the correct block is found using the call insts for foo and bar.
32;
33; LINUX-SECTIONS: .section        .text._Z3bazb,"ax",@progbits
34; LINUX-SECTIONS: _Z3bazb:
35; Check that the basic block with id 1 doesn't get a section.
36; LINUX-SECTIONS-NOT: .section        .text._Z3bazb._Z3bazb.__part.{{[0-9]+}},"ax",@progbits
37; LINUX-SECTIONS-LABEL: # %bb.1:
38; LINUX-SECTIONS-NEXT:        callq   _Z3barv
39; LINUX-SECTIONS: .section        .text._Z3bazb.[[SECTION_LABEL:_Z3bazb.__part.[0-9]+]],"ax",@progbits
40; LINUX-SECTIONS-NEXT: [[SECTION_LABEL]]:
41; LINUX-SECTIONS-NEXT:        callq   _Z3foov
42; LINUX-SECTIONS: .LBB_END0_2:
43; LINUX-SECTIONS-NEXT: .size   [[SECTION_LABEL]], .LBB_END0_2-[[SECTION_LABEL]]
44; LINUX-SECTIONS: .section        .text._Z3bazb,"ax",@progbits
45; LINUX-SECTIONS: .Lfunc_end0:
46; LINUX-SECTIONS-NEXT: .size _Z3bazb, .Lfunc_end0-_Z3bazb
47