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.
7 ;; Profile for version 0:
8 ; RUN: echo '!foo' > %t1
9 ; RUN: echo '!!0 2' >> %t1
10 ; RUN: echo '!!1' >> %t1
12 ;; Profile for version 1:
13 ; RUN: echo 'v1' > %t2
14 ; RUN: echo 'f foo' >> %t2
15 ; RUN: echo 'c 0 2' >> %t2
16 ; RUN: echo 'c 1' >> %t2
18 ; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t1 | FileCheck %s -check-prefix=LINUX-SECTIONS1
19 ; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t2 | FileCheck %s -check-prefix=LINUX-SECTIONS1
21 ; Test2: Basic blocks #1 and #3 will be placed in the same section.
22 ; All other BBs (including the entry block) go into the function's section.
23 ; RUN: echo '!foo' > %t3
24 ; RUN: echo '!!1 3' >> %t3
25 ; RUN: echo 'v1' > %t4
26 ; RUN: echo 'f foo' >> %t4
27 ; RUN: echo 'c 1 3' >> %t4
28 ; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t3 | FileCheck %s -check-prefix=LINUX-SECTIONS2
29 ; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t4 | FileCheck %s -check-prefix=LINUX-SECTIONS2
31 define void @foo(i1 zeroext) nounwind {
32 %2 = alloca i8, align 1
34 store i8 %3, ptr %2, align 1
35 %4 = load i8, ptr %2, align 1
36 %5 = trunc i8 %4 to i1
37 br i1 %5, label %6, label %8
55 ; LINUX-SECTIONS1: .section .text.foo,"ax",@progbits
56 ; LINUX-SECTIONS1-NOT: .section
57 ; LINUX-SECTIONS1-LABEL: foo:
58 ; LINUX-SECTIONS1-NOT: .section
59 ; LINUX-SECTIONS1-NOT: .LBB_END0_{{0-9}}+
60 ; LINUX-SECTIONS1-LABEL: # %bb.2:
61 ; LINUX-SECTIONS1-NOT: .LBB_END0_{{0-9}}+
62 ; LINUX-SECTIONS1: .section .text.foo,"ax",@progbits,unique,1
63 ; LINUX-SECTIONS1-LABEL: foo.__part.1:
64 ; LINUX-SECTIONS1-LABEL: .LBB_END0_1:
65 ; LINUX-SECTIONS1-NEXT: .size foo.__part.1, .LBB_END0_1-foo.__part.1
66 ; LINUX-SECTIONS1-NOT: .section
67 ; LINUX-SECTIONS1: .section .text.split.foo,"ax",@progbits
68 ; LINUX-SECTIONS1-LABEL: foo.cold:
69 ; LINUX-SECTIONS1-LABEL: .LBB_END0_3:
70 ; LINUX-SECTIONS1-NEXT: .size foo.cold, .LBB_END0_3-foo.cold
71 ; LINUX-SECTIONS1: .section .text.foo,"ax",@progbits
72 ; LINUX-SECTIONS1-LABEL: .Lfunc_end0:
73 ; LINUX-SECTIONS1-NEXT: .size foo, .Lfunc_end0-foo
75 ; LINUX-SECTIONS2: .section .text.foo,"ax",@progbits
76 ; LINUX-SECTIONS2-NOT: .section
77 ; LINUX-SECTIONS2-LABEL: foo:
78 ; LINUX-SECTIONS2-NOT: .LBB_END0_{{0-9}}+
79 ; LINUX-SECTIONS2-NOT: .section
80 ; LINUX-SECTIONS2-LABEL: # %bb.2:
81 ; LINUX-SECTIONS2-NOT: .LBB_END0_{{0-9}}+
82 ; LINUX-SECTIONS2: .section .text.foo,"ax",@progbits,unique,1
83 ; LINUX-SECTIONS2-NEXT: foo.__part.0:
84 ; LINUX-SECTIONS2-NOT: .LBB_END0_{{0-9}}+
85 ; LINUX-SECTIONS2-NOT: .section
86 ; LINUX-SECTIONS2-LABEL: .LBB0_3:
87 ; LINUX-SECTIONS2-LABEL: .LBB_END0_3:
88 ; LINUX-SECTIONS2-NEXT: .size foo.__part.0, .LBB_END0_3-foo.__part.0
89 ; LINUX-SECTIONS2: .section .text.foo,"ax",@progbits
90 ; LINUX-SECTIONS2-NOT: .LBB_END0_{{0-9}}+
91 ; LINUX-SECTIONS2-LABEL: .Lfunc_end0:
92 ; LINUX-SECTIONS2-NEXT: .size foo, .Lfunc_end0-foo