1 ; BB cluster section tests.
3 ; Test1: Basic blocks #0 (entry) and #2 will be placed in the same section.
4 ; Basic block 1 will be placed in a unique section.
5 ; The rest will be placed in the cold section.
6 ; RUN: echo '!foo' > %t1
7 ; RUN: echo '!!0 2' >> %t1
8 ; RUN: echo '!!1' >> %t1
9 ; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t1 | FileCheck %s -check-prefix=LINUX-SECTIONS1
11 ; Test2: Basic blocks #1 and #3 will be placed in the same section.
12 ; All other BBs (including the entry block) go into the function's section.
13 ; RUN: echo '!foo' > %t2
14 ; RUN: echo '!!1 3' >> %t2
15 ; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t2 | FileCheck %s -check-prefix=LINUX-SECTIONS2
17 define void @foo(i1 zeroext) nounwind {
18 %2 = alloca i8, align 1
20 store i8 %3, i8* %2, align 1
21 %4 = load i8, i8* %2, align 1
22 %5 = trunc i8 %4 to i1
23 br i1 %5, label %6, label %8
41 ; LINUX-SECTIONS1: .section .text.foo,"ax",@progbits
42 ; LINUX-SECTIONS1-NOT: .section
43 ; LINUX-SECTIONS1-LABEL: foo:
44 ; LINUX-SECTIONS1-NOT: .section
45 ; LINUX-SECTIONS1-NOT: .LBB_END0_{{0-9}}+
46 ; LINUX-SECTIONS1-LABEL: # %bb.2:
47 ; LINUX-SECTIONS1-NOT: .LBB_END0_{{0-9}}+
48 ; LINUX-SECTIONS1: .section .text.foo,"ax",@progbits,unique,1
49 ; LINUX-SECTIONS1-LABEL: foo.__part.1:
50 ; LINUX-SECTIONS1-LABEL: .LBB_END0_1:
51 ; LINUX-SECTIONS1-NEXT: .size foo.__part.1, .LBB_END0_1-foo.__part.1
52 ; LINUX-SECTIONS1-NOT: .section
53 ; LINUX-SECTIONS1: .section .text.split.foo,"ax",@progbits
54 ; LINUX-SECTIONS1-LABEL: foo.cold:
55 ; LINUX-SECTIONS1-LABEL: .LBB_END0_3:
56 ; LINUX-SECTIONS1-NEXT: .size foo.cold, .LBB_END0_3-foo.cold
57 ; LINUX-SECTIONS1: .section .text.foo,"ax",@progbits
58 ; LINUX-SECTIONS1-LABEL: .Lfunc_end0:
59 ; LINUX-SECTIONS1-NEXT: .size foo, .Lfunc_end0-foo
61 ; LINUX-SECTIONS2: .section .text.foo,"ax",@progbits
62 ; LINUX-SECTIONS2-NOT: .section
63 ; LINUX-SECTIONS2-LABEL: foo:
64 ; LINUX-SECTIONS2-NOT: .LBB_END0_{{0-9}}+
65 ; LINUX-SECTIONS2-NOT: .section
66 ; LINUX-SECTIONS2-LABEL: # %bb.2:
67 ; LINUX-SECTIONS2-NOT: .LBB_END0_{{0-9}}+
68 ; LINUX-SECTIONS2: .section .text.foo,"ax",@progbits,unique,1
69 ; LINUX-SECTIONS2-NEXT: foo.__part.0:
70 ; LINUX-SECTIONS2-NOT: .LBB_END0_{{0-9}}+
71 ; LINUX-SECTIONS2-NOT: .section
72 ; LINUX-SECTIONS2-LABEL: .LBB0_3:
73 ; LINUX-SECTIONS2-LABEL: .LBB_END0_3:
74 ; LINUX-SECTIONS2-NEXT: .size foo.__part.0, .LBB_END0_3-foo.__part.0
75 ; LINUX-SECTIONS2: .section .text.foo,"ax",@progbits
76 ; LINUX-SECTIONS2-NOT: .LBB_END0_{{0-9}}+
77 ; LINUX-SECTIONS2-LABEL: .Lfunc_end0:
78 ; LINUX-SECTIONS2-NEXT: .size foo, .Lfunc_end0-foo