File: basic-block-sections-named-section.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (42 lines) | stat: -rw-r--r-- 1,525 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
; RUN: llc < %s -mtriple=x86_64-pc-linux -basic-block-sections=all | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=all | FileCheck %s
; RUN: echo "!_Z3fooi" > %t.order.txt
; RUN: echo "!!2" >> %t.order.txt
; RUN: llc < %s -mtriple=x86_64-pc-linux -basic-block-sections=%t.order.txt | FileCheck %s --check-prefix=LIST
; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t.order.txt | FileCheck %s --check-prefix=LIST

; CHECK: .section	foo_section,"ax",@progbits,unique,1
; CHECK-LABEL: _Z3fooi:
; CHECK: .section	foo_section,"ax",@progbits,unique,2
; CHECK-NEXT: _Z3fooi.__part.1:
; CHECK: .section	foo_section,"ax",@progbits,unique,3
; CHECK-NEXT: _Z3fooi.__part.2:

; LIST: .section	foo_section,"ax",@progbits,unique,1
; LIST-LABEL: _Z3fooi:
; LIST: .section	foo_section,"ax",@progbits,unique,2
; LIST-NEXT: _Z3fooi.__part.0:
; LIST-NOT: .section	foo_section,"ax",@progbits,unique,3

;; Source to generate the IR:
;; __attribute__((section("foo_section")))
;; int foo(int n) {
;;   if (n < 0)
;;     exit(-1);
;;   return 0;
;; }

define dso_local i32 @_Z3fooi(i32 %n) local_unnamed_addr section "foo_section" {
entry:
  %cmp = icmp slt i32 %n, 0
  br i1 %cmp, label %if.then, label %if.end

if.then:                                          ; preds = %entry
  tail call void @exit(i32 -1) #2
  unreachable

if.end:                                           ; preds = %entry
  ret i32 0
}

declare dso_local void @exit(i32) local_unnamed_addr