1# REQUIRES: x86 2# RUN: rm -rf %t* 3 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 7 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. 15 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 29 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{{.*}}>: 36 37.subsections_via_symbols 38.text 39.p2align 2 40 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 48 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 55 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 62 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 69 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 76 77gen_1024 0 78gen_1024 1 79gen_1024 2 80gen_1024 3 81 82.globl _main 83_main: 84 ret 85