Files
TheRock/compiler/amd-llvm/bolt/test/X86/instrument-funcs-file.s
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

83 lines
2.6 KiB
ArmAsm

# Test --instrument-funcs-file, alone and combined with --instrument-hot-only.
#
# The binary defines three functions (foo, bar, baz). We attach a profile that
# only marks foo as hot. With --instrument-funcs-file listing foo and bar, only
# those two are instrumented. Adding --instrument-hot-only further restricts
# instrumentation to foo (the only function that is both listed and hot).
# REQUIRES: system-linux,bolt-runtime,target=x86_64-{{.*}}
# RUN: %clang %cflags %s -o %t.exe -Wl,-q
# RUN: link_fdata %s %t.exe %t.fdata
# Funcs file lists foo and bar (baz is intentionally omitted).
# RUN: echo "foo" > %t.funcs
# RUN: echo "bar" >> %t.funcs
# Test A: only --instrument-funcs-file. Both foo and bar get instrumented.
# RUN: llvm-bolt --instrument --instrument-funcs-file=%t.funcs \
# RUN: -o %t.a.out %t.exe 2>&1 | FileCheck %s --check-prefix=CHECK-A
# Test B: --instrument-funcs-file combined with --instrument-hot-only. Profile
# marks only foo as hot, so bar is filtered out by --instrument-hot-only.
# RUN: llvm-bolt --instrument --instrument-funcs-file=%t.funcs \
# RUN: --instrument-hot-only --data %t.fdata \
# RUN: -o %t.b.out %t.exe 2>&1 | FileCheck %s --check-prefix=CHECK-B
# Test C: empty file means "no functions match", so nothing is instrumented.
# RUN: rm -f %t.empty && touch %t.empty
# RUN: llvm-bolt --instrument --instrument-funcs-file=%t.empty \
# RUN: -o %t.c.out %t.exe 2>&1 | FileCheck %s --check-prefix=CHECK-C
# Test D: missing file produces a fatal error.
# RUN: not llvm-bolt --instrument --instrument-funcs-file=%t.missing \
# RUN: -o %t.d.out %t.exe 2>&1 | FileCheck %s --check-prefix=CHECK-D
# CHECK-A: BOLT-INSTRUMENTER: Number of function descriptors: 2
# CHECK-B: BOLT-INSTRUMENTER: Number of function descriptors: 1
# CHECK-C: BOLT-INSTRUMENTER: Number of function descriptors: 0
# CHECK-D: instrument-funcs-file {{.*}}.missing{{.*}} can't be opened
.text
.globl _start
.type _start, %function
_start:
call foo
call bar
call baz
retq
.size _start, .-_start
.globl foo
.type foo, %function
foo:
# FDATA: 0 [unknown] 0 1 foo 0 0 100
retq
.size foo, .-foo
.globl bar
.type bar, %function
bar:
retq
.size bar, .-bar
.globl baz
.type baz, %function
baz:
retq
.size baz, .-baz
.globl _init
.type _init, %function
# Force DT_INIT to be created (needed for instrumentation).
_init:
retq
.size _init, .-_init
.globl _fini
.type _fini, %function
# Force DT_FINI to be created (needed for instrumentation).
_fini:
retq
.size _fini, .-_fini