aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AArch64/stack-size-section.ll
blob: e7429032da16a50398363d6025e0dc2e87b4df07 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
; RUN: llc -mtriple=aarch64 -aarch64-min-jump-table-entries=4 -stack-size-section %s -o - | FileCheck %s

; CHECK-LABEL: .section .stack_sizes,"o",@progbits,.text{{$}}
; CHECK-NEXT: .xword .Lfunc_begin0
; CHECK-NEXT: .byte 0
define void @empty() {
  ret void
}

; CHECK-LABEL: .section .stack_sizes,"o",@progbits,.text{{$}}
; CHECK-NEXT: .xword .Lfunc_begin1
; CHECK-NEXT: .ascii "\200\001"
define void @non_empty() #0 {
  alloca [32 x i32]
  ret void
}

; CHECK-LABEL: dynalloc:
; CHECK-NOT: .section .stack_sizes
define void @dynalloc(i32 %n) #0 {
  alloca i32, i32 %n
  ret void
}

; Check that .stack_sizes section is linked to the function's section (.text),
; and not to the section containing the jump table (.rodata).
; CHECK-LABEL: linked_section:
; CHECK: .section .rodata,"a",@progbits
; CHECK: .section .stack_sizes,"o",@progbits,.text
; CHECK-NEXT: .xword .Lfunc_begin3
; CHECK-NEXT: .ascii "\220\001"
declare void @case0()
declare void @case1()
declare void @case2()
declare void @case3()
define void @linked_section(i32 %x) {
  %arr = alloca [32 x i32]
  switch i32 %x, label %sw.epilog [
    i32 0, label %sw.bb0
    i32 1, label %sw.bb1
    i32 2, label %sw.bb2
    i32 3, label %sw.bb3
  ]

sw.bb0:
  call void @case0()
  ret void

sw.bb1:
  call void @case1()
  ret void

sw.bb2:
  call void @case2()
  ret void

sw.bb3:
  call void @case3()
  ret void

sw.epilog:
  ret void
}