1 ;; Tests for basic block sections applied on a function in a custom section.
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux -basic-block-sections=all | FileCheck %s
3 ; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=all | FileCheck %s
4 ; RUN: echo "!_Z3fooi" > %t1.list.txt
5 ; RUN: echo "!!2" >> %t1.list.txt
6 ; RUN: llc < %s -mtriple=x86_64-pc-linux -basic-block-sections=%t1.list.txt | FileCheck %s --check-prefix=LIST1
7 ; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t1.list.txt | FileCheck %s --check-prefix=LIST1
8 ; RUN: echo "!_Z3fooi" > %t2.list.txt
9 ; RUN: echo "!!0" >> %t2.list.txt
10 ; RUN: llc < %s -mtriple=x86_64-pc-linux -basic-block-sections=%t2.list.txt | FileCheck %s --check-prefix=LIST2
11 ; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t2.list.txt | FileCheck %s --check-prefix=LIST2
14 ; CHECK: .section foo_section,"ax",@progbits,unique,1
15 ; CHECK-LABEL: _Z3fooi:
16 ; CHECK: .section foo_section,"ax",@progbits,unique,2
17 ; CHECK-NEXT: _Z3fooi.__part.1:
18 ; CHECK: .section foo_section,"ax",@progbits,unique,3
19 ; CHECK-NEXT: _Z3fooi.__part.2:
21 ; LIST1: .section foo_section,"ax",@progbits,unique,1
22 ; LIST1-LABEL: _Z3fooi:
23 ; LIST1: .section foo_section,"ax",@progbits,unique,2
24 ; LIST1-NEXT: _Z3fooi.__part.0:
25 ; LIST1-NOT: .section foo_section,"ax",@progbits,unique,3
27 ; LIST2: .section foo_section,"ax",@progbits,unique,1
28 ; LIST2-LABEL: _Z3fooi:
29 ; LIST2: .section foo_section,"ax",@progbits,unique,2
30 ; LIST2-NEXT: _Z3fooi.cold:
31 ; LIST2-NOT: .section foo_section,"ax",@progbits,unique,3
33 ;; Source to generate the IR:
34 ;; #pragma clang section text = "foo_section"
41 define dso_local i32 @_Z3fooi(i32 %n) local_unnamed_addr section "foo_section" {
43 %cmp = icmp slt i32 %n, 0
44 br i1 %cmp, label %if.then, label %if.end
46 if.then: ; preds = %entry
47 tail call void @exit(i32 -1) #2
50 if.end: ; preds = %entry
54 declare dso_local void @exit(i32) local_unnamed_addr