Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / icf-scale.s
blob8292dcf9591459caaee3cac04027391123b37946
1 # REQUIRES: x86
2 # RUN: rm -rf %t*
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
5 # RUN: %lld -lSystem --icf=all -o %t %t.o
6 # RUN: llvm-objdump -d --syms %t | FileCheck %s
8 ## When ICF has fewer than 1 Ki functions to segregate into equivalence classes,
9 ## it uses a sequential algorithm to avoid the overhead of threading.
10 ## At 1 Ki functions or more, when threading begins to pay-off, ICF employs its
11 ## parallel segregation algorithm. Here we generate 4 Ki functions to exercise
12 ## the parallel algorithm. There are 4 unique function bodies, each replicated
13 ## 1 Ki times. The resulting folded program should retain one instance for each
14 ## of the four unique functions.
16 ## The symtab does not have a particular order. And even though we can expect
17 ## some partial order, it is not possible to express that in FileCheck syntax.
18 ## So just use -DAG
19 # CHECK-LABEL: SYMBOL TABLE:
20 # CHECK-DAG: [[#%x,G0:]] g F __TEXT,__text _g000000
21 # CHECK-DAG: [[#%x,G0]] g F __TEXT,__text _g033333
22 # CHECK-DAG: [[#%x,G1:]] g F __TEXT,__text _g100000
23 # CHECK-DAG: [[#%x,G1]] g F __TEXT,__text _g133333
24 # CHECK-DAG: [[#%x,G2:]] g F __TEXT,__text _g200000
25 # CHECK-DAG: [[#%x,G2]] g F __TEXT,__text _g233333
26 # CHECK-DAG: [[#%x,G3:]] g F __TEXT,__text _g300000
27 # CHECK-DAG: [[#%x,G3]] g F __TEXT,__text _g333333
28 ## . . . many intervening _gXXXXXX symbols
30 # CHECK-LABEL: Disassembly of section __TEXT,__text:
31 # CHECK-DAG: [[#%x,G0]] <_g033333>:
32 # CHECK-DAG: [[#%x,G1]] <_g133333>:
33 # CHECK-DAG: [[#%x,G2]] <_g233333>:
34 # CHECK-DAG: [[#%x,G3]] <_g333333>:
35 # CHECK-NOT: [[#]] <_g{{.*}}>:
37 .subsections_via_symbols
38 .text
39 .p2align 2
41 .macro gen_4 c
42 .globl _g0\c, _g1\c, _g2\c, _g3\c
43 _g0\c:; movl $0, %eax; ret
44 _g1\c:; movl $1, %eax; ret
45 _g2\c:; movl $2, %eax; ret
46 _g3\c:; movl $3, %eax; ret
47 .endm
49 .macro gen_16 c
50 gen_4 0\c
51 gen_4 1\c
52 gen_4 2\c
53 gen_4 3\c
54 .endm
56 .macro gen_64 c
57 gen_16 0\c
58 gen_16 1\c
59 gen_16 2\c
60 gen_16 3\c
61 .endm
63 .macro gen_256 c
64 gen_64 0\c
65 gen_64 1\c
66 gen_64 2\c
67 gen_64 3\c
68 .endm
70 .macro gen_1024 c
71 gen_256 0\c
72 gen_256 1\c
73 gen_256 2\c
74 gen_256 3\c
75 .endm
77 gen_1024 0
78 gen_1024 1
79 gen_1024 2
80 gen_1024 3
82 .globl _main
83 _main:
84 ret