Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / compact-unwind-stack-ind.s
blob045abbe2fc1d0c9ef1e9dcf1507ced957e051f3b
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %s -o %t.o
3 # RUN: %lld -arch x86_64 -dylib %t.o -o %t.dylib
4 # RUN: llvm-objdump --macho --syms --unwind-info %t.dylib | FileCheck %s
6 ## Both _f and _g have the same compact unwind encoding,
7 ## but different stack sizes. So their compact unwindings
8 ## can't be merged.
9 # CHECK: SYMBOL TABLE:
10 # CHECK: [[#%x,F:]] g F __TEXT,__text _f
11 # CHECK: [[#%x,G:]] g F __TEXT,__text _g
12 # CHECK: Number of common encodings in array: 0x1
13 # CHECK: Common encodings: (count = 1)
14 # CHECK: encoding[0]: 0x03032000
15 # CHECK: Second level indices:
16 # CHECK: Second level index[0]:
17 # CHECK: [0]: function offset=0x[[#%.8x,F]], encoding[0]=0x03032000
18 # CHECK: [1]: function offset=0x[[#%.8x,G]], encoding[0]=0x03032000
20 ## Based on compiling
21 ## int f() {
22 ## char alloca[3260] = { 0 };
23 ## return alloca[0];
24 ## }
26 ## int g() {
27 ## char alloca[2560] = { 0 };
28 ## return alloca[0];
29 ## }
30 ## with `-fomit-frame-pointer -fno-stack-protector -S`.
31 .section __TEXT,__text,regular,pure_instructions
32 .build_version macos, 10, 15 sdk_version 10, 15, 6
34 .globl _f
35 .p2align 4, 0x90
36 _f:
37 .cfi_startproc
38 subq $3272, %rsp
39 .cfi_def_cfa_offset 3280
40 addq $3272, %rsp
41 retq
42 .cfi_endproc
44 .globl _g
45 .p2align 4, 0x90
46 _g:
47 .cfi_startproc
48 subq $2568, %rsp
49 .cfi_def_cfa_offset 2576
50 addq $2568, %rsp
51 retq
52 .cfi_endproc
54 .subsections_via_symbols