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.
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
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