Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / CodeGen / X86 / basic-block-sections-named-section.ll
blob213b1a0f13f6bca7f5d61efe6b1120384eb51598
1 ; RUN: llc < %s -mtriple=x86_64-pc-linux -basic-block-sections=all | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=all | FileCheck %s
3 ; RUN: echo "!_Z3fooi" > %t.order.txt
4 ; RUN: echo "!!2" >> %t.order.txt
5 ; RUN: llc < %s -mtriple=x86_64-pc-linux -basic-block-sections=%t.order.txt | FileCheck %s --check-prefix=LIST
6 ; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t.order.txt | FileCheck %s --check-prefix=LIST
8 ; CHECK: .section       foo_section,"ax",@progbits,unique,1
9 ; CHECK-LABEL: _Z3fooi:
10 ; CHECK: .section       foo_section,"ax",@progbits,unique,2
11 ; CHECK-NEXT: _Z3fooi.__part.1:
12 ; CHECK: .section       foo_section,"ax",@progbits,unique,3
13 ; CHECK-NEXT: _Z3fooi.__part.2:
15 ; LIST: .section        foo_section,"ax",@progbits,unique,1
16 ; LIST-LABEL: _Z3fooi:
17 ; LIST: .section        foo_section,"ax",@progbits,unique,2
18 ; LIST-NEXT: _Z3fooi.__part.0:
19 ; LIST-NOT: .section    foo_section,"ax",@progbits,unique,3
21 ;; Source to generate the IR:
22 ;; __attribute__((section("foo_section")))
23 ;; int foo(int n) {
24 ;;   if (n < 0)
25 ;;     exit(-1);
26 ;;   return 0;
27 ;; }
29 define dso_local i32 @_Z3fooi(i32 %n) local_unnamed_addr section "foo_section" {
30 entry:
31   %cmp = icmp slt i32 %n, 0
32   br i1 %cmp, label %if.then, label %if.end
34 if.then:                                          ; preds = %entry
35   tail call void @exit(i32 -1) #2
36   unreachable
38 if.end:                                           ; preds = %entry
39   ret i32 0
42 declare dso_local void @exit(i32) local_unnamed_addr