xref: /llvm-project/bolt/test/X86/ignored-interprocedural-reference.s (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1## This reproduces a bug with not processing interprocedural references from
2## ignored functions.
3
4# REQUIRES: system-linux
5
6# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
7# RUN: %clang %cflags %t.o -o %t.exe -nostdlib -Wl,-q
8# RUN: llvm-bolt %t.exe -o %t.out --enable-bat -funcs=main
9# RUN: link_fdata %s %t.out %t.preagg PREAGG
10# RUN: perf2bolt %t.out -p %t.preagg --pa -o %t.fdata -w %t.yaml
11# RUN: FileCheck %s --input-file=%t.fdata --check-prefix=CHECK-FDATA
12# RUN: FileCheck %s --input-file=%t.yaml --check-prefix=CHECK-YAML
13
14# CHECK-FDATA: 1 main 0 1 foo a 1 1
15# CHECK-YAML: name: main
16# CHECK-YAML: calls: {{.*}} disc: 1
17
18# PREAGG: B #main# #foo_secondary# 1 1
19## main calls foo at valid instruction offset past nops that are to be stripped.
20  .globl main
21main:
22  .cfi_startproc
23  call foo_secondary
24  ret
25  .cfi_endproc
26.size main,.-main
27
28## Placeholder cold fragment to force main to be ignored in non-relocation mode.
29  .globl main.cold
30main.cold:
31  .cfi_startproc
32  ud2
33  .cfi_endproc
34.size main.cold,.-main.cold
35
36## foo is set up to contain a valid instruction at called offset, and trapping
37## instructions past that.
38  .globl foo
39foo:
40  .cfi_startproc
41  .nops 10
42  .globl foo_secondary
43foo_secondary:
44  ret
45  .rept 20
46  int3
47  .endr
48  .cfi_endproc
49.size foo,.-foo
50