xref: /llvm-project/llvm/test/CodeGen/X86/stack-size-section.ll (revision 7620f03ef7a662384d67b6bd1fad8582dfe9dd82)
1; RUN: llc < %s -mtriple=x86_64-linux -stack-size-section | FileCheck %s --check-prefix=CHECK --check-prefix=GROUPS
2
3; PS4 'as' does not recognize the section attribute "o".  So we have a simple .stack_sizes section on PS4.
4; RUN: llc < %s -mtriple=x86_64-scei-ps4 -stack-size-section | FileCheck %s --check-prefix=CHECK --check-prefix=NOGROUPS
5
6; CHECK-LABEL: func1:
7; CHECK-NEXT: .Lfunc_begin0:
8; GROUPS: .section .stack_sizes,"o",@progbits,.text{{$}}
9; NOGROUPS: .section .stack_sizes,"",@progbits
10; CHECK-NEXT: .quad .Lfunc_begin0
11; CHECK-NEXT: .byte 8
12define void @func1(i32, i32) #0 {
13  alloca i32, align 4
14  alloca i32, align 4
15  ret void
16}
17
18; CHECK-LABEL: func2:
19; CHECK-NEXT: .Lfunc_begin1:
20; GROUPS: .section .stack_sizes,"o",@progbits,.text{{$}}
21; NOGROUPS: .section .stack_sizes,"",@progbits
22; CHECK-NEXT: .quad .Lfunc_begin1
23; CHECK-NEXT: .byte 24
24define void @func2() #0 {
25  alloca i32, align 4
26  call void @func1(i32 1, i32 2)
27  ret void
28}
29
30; Check that we still put .stack_sizes into the corresponding COMDAT group if any.
31; CHECK: .section .text._Z4fooTIiET_v,"axG",@progbits,_Z4fooTIiET_v,comdat
32; GROUPS: .section .stack_sizes,"oG",@progbits,.text._Z4fooTIiET_v,_Z4fooTIiET_v,comdat{{$}}
33; NOGROUPS: .section .stack_sizes,"",@progbits
34$_Z4fooTIiET_v = comdat any
35define linkonce_odr dso_local i32 @_Z4fooTIiET_v() comdat {
36  ret i32 0
37}
38
39; CHECK: .section .text.func3,"ax",@progbits
40; GROUPS: .section .stack_sizes,"o",@progbits,.text.func3{{$}}
41; NOGROUPS: .section .stack_sizes,"",@progbits
42define dso_local i32 @func3() section ".text.func3" {
43  %1 = alloca i32, align 4
44  store i32 0, ptr %1, align 4
45  ret i32 0
46}
47
48; CHECK-LABEL: dynalloc:
49; CHECK-NOT: .section .stack_sizes
50define void @dynalloc(i32 %N) #0 {
51  alloca i32, i32 %N
52  ret void
53}
54
55attributes #0 = { "frame-pointer"="all" }
56