85 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t*3 4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o5# RUN: %lld -lSystem --icf=all -o %t %t.o6# RUN: llvm-objdump -d --syms %t | FileCheck %s7 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 its11## parallel segregation algorithm. Here we generate 4 Ki functions to exercise12## the parallel algorithm. There are 4 unique function bodies, each replicated13## 1 Ki times. The resulting folded program should retain one instance for each14## of the four unique functions.15 16## The symtab does not have a particular order. And even though we can expect17## some partial order, it is not possible to express that in FileCheck syntax.18## So just use -DAG19# CHECK-LABEL: SYMBOL TABLE:20# CHECK-DAG: [[#%x,G0:]] g F __TEXT,__text _g00000021# CHECK-DAG: [[#%x,G0]] g F __TEXT,__text _g03333322# CHECK-DAG: [[#%x,G1:]] g F __TEXT,__text _g10000023# CHECK-DAG: [[#%x,G1]] g F __TEXT,__text _g13333324# CHECK-DAG: [[#%x,G2:]] g F __TEXT,__text _g20000025# CHECK-DAG: [[#%x,G2]] g F __TEXT,__text _g23333326# CHECK-DAG: [[#%x,G3:]] g F __TEXT,__text _g30000027# CHECK-DAG: [[#%x,G3]] g F __TEXT,__text _g33333328## . . . many intervening _gXXXXXX symbols29 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_symbols38.text39.p2align 240 41.macro gen_4 c42 .globl _g0\c, _g1\c, _g2\c, _g3\c43 _g0\c:; movl $0, %eax; ret44 _g1\c:; movl $1, %eax; ret45 _g2\c:; movl $2, %eax; ret46 _g3\c:; movl $3, %eax; ret47.endm48 49.macro gen_16 c50 gen_4 0\c51 gen_4 1\c52 gen_4 2\c53 gen_4 3\c54.endm55 56.macro gen_64 c57 gen_16 0\c58 gen_16 1\c59 gen_16 2\c60 gen_16 3\c61.endm62 63.macro gen_256 c64 gen_64 0\c65 gen_64 1\c66 gen_64 2\c67 gen_64 3\c68.endm69 70.macro gen_1024 c71 gen_256 0\c72 gen_256 1\c73 gen_256 2\c74 gen_256 3\c75.endm76 77gen_1024 078gen_1024 179gen_1024 280gen_1024 381 82.globl _main83_main:84 ret85