brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 27b0cf4 Raw
64 lines · plain
1## Check that BOLT handles correctly folding functions with --icf=safe that are only referenced from a .rela.data section.2 3# REQUIRES: system-linux, asserts4# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o5# RUN: %clang %cflags %t1.o -o %t.exe -Wl,-q -no-pie6# RUN: llvm-bolt --no-threads %t.exe --icf -debug-only=bolt-icf -o %t.bolt 2>&1 | FileCheck --check-prefix=ICFCHECK %s7# RUN: llvm-bolt --no-threads %t.exe --icf=safe -debug-only=bolt-icf -o %t.bolt 2>&1 | FileCheck --check-prefix=SAFEICFCHECK %s8 9# ICFCHECK:      ICF iteration 110# ICFCHECK-NEXT: folding barAddFunc into fooAddFunc11 12# SAFEICFCHECK:      skipping function with reference taken fooAddFunc13# SAFEICFCHECK-NEXT: skipping function with reference taken barAddFunc14# SAFEICFCHECK-NEXT: ICF iteration 115 16## clang++ main.cpp17## Other functions removed for brevity.18## int main(int argc, char **argv) {19##  const static int (*const funcGlobalBarAdd)(int, int) = barAddHdlper;20##  const int (* const funcGlobalBarMul)(int, int) = fooGlobalFuncHelper;21##  helper2(funcGlobalBarAdd, funcGlobalFooAdd, 3, 4)22## }23## Extra assembly removed.24 25	.globl	fooAddFunc26	.type	fooAddFunc,@function27fooAddFunc:28	addl	-8(%rbp), %eax29	retq30	.size	fooAddFunc, .-fooAddFunc31 32	.globl	barAddFunc33	.type	barAddFunc,@function34barAddFunc:35	addl	-8(%rbp), %eax36	retq37	.size	barAddFunc, .-barAddFunc38 39	.globl	helperFunc40	.type	helperFunc,@function41helperFunc:42	retq43	.size	helperFunc, .-helperFunc44 45	.globl	main46	.type	main,@function47main:48	movq	localStaticVarBarAdd, %rdi49	movq	localStaticVarFooAdd, %rsi50	callq	helperFunc51	retq52	.size	main, .-main53 54	.type	localStaticVarBarAdd,@object # @localStaticVarBarAdd55	.data56localStaticVarBarAdd:57	.quad	barAddFunc58	.size	localStaticVarBarAdd, 859 60	.type	localStaticVarFooAdd,@object # @localStaticVarFooAdd61localStaticVarFooAdd:62	.quad	fooAddFunc63	.size	localStaticVarFooAdd, 864