Files
TheRock/compiler/amd-llvm/bolt/test/X86/pre-aggregated-perf-shlib.test
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

76 lines
3.0 KiB
Plaintext

## Test that perf2bolt correctly detects shared objects using identify_magic
## and activates build ID filtering for pre-aggregated profiles.
# REQUIRES: system-linux
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
# RUN: %clang %cflags %t.o -o %t.so -shared -Wl,-q -Wl,--build-id=0xaabb1122 -nostdlib
# RUN: %clang %cflags %t.o -o %t.exe -fPIC -pie -Wl,-q -Wl,--build-id=0xaabb1122 -nostdlib
# RUN: link_fdata %s %t.so %t.pa PREAGG
# RUN: link_fdata %s %t.exe %t.pa-pie PREAGG
# RUN: link_fdata %s %t.so %t.pa-bid PREAGG-BID
## Test 1: Without buildid prefix, addresses don't match the .so's buildid
## and are treated as external → 0 functions with profile.
# RUN: perf2bolt %t.so -o %t.fdata --pa -p %t.pa \
# RUN: --profile-format=fdata 2>&1 | FileCheck %s --check-prefix=CHECK-NEG
# CHECK-NEG: PERF2BOLT: filtering pre-aggregated data for buildid aabb1122
# CHECK-NEG: BOLT-INFO: 0 out of {{[0-9]+}} functions in the binary (0.0%) have non-empty execution profile
## Test 2: With matching buildid prefix, addresses are recognized.
# RUN: perf2bolt %t.so -o %t.fdata2 --pa -p %t.pa-bid \
# RUN: --profile-format=fdata 2>&1 | FileCheck %s --check-prefix=CHECK-POS
# CHECK-POS: PERF2BOLT: filtering pre-aggregated data for buildid aabb1122
# CHECK-POS: BOLT-INFO: 1 out of {{[0-9]+}} functions in the binary
# CHECK-POS-NOT: (0.0%)
.text
.globl foo
.type foo, @function
foo:
pushq %rbp
movq %rsp, %rbp
cmpl $0, %edi
Lbr:
je Lfalse
Ltrue:
movl $1, %eax
jmp Lret
Lfalse:
xorl %eax, %eax
Lret:
popq %rbp
retq
.size foo, .-foo
# PREAGG: T #Lbr# #Lfalse# #Lret# 10
# PREAGG-BID: T aabb1122:#Lbr# aabb1122:#Lfalse# aabb1122:#Lret# 10
## Test 3: Executable with ".so" in the filename should NOT trigger filtering.
## The old heuristic (ends_with(".so")) would false-positive here, but
## identify_magic correctly identifies it as an executable.
# RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe.so
# RUN: perf2bolt %t.exe.so -o %t.fdata3 --pa -p %p/Inputs/pre-aggregated.txt \
# RUN: --profile-format=fdata 2>&1 | FileCheck %s --check-prefix=CHECK-EXE
# CHECK-EXE-NOT: filtering pre-aggregated data for buildid
# CHECK-EXE: BOLT-INFO: 4 out of 7 functions in the binary (57.1%) have non-empty execution profile
## Test 4: Shared library without ".so" in the filename should still trigger
## filtering. The old heuristic would false-negative here, but identify_magic
## correctly identifies it as a shared object.
# RUN: cp %t.so %t.dynlib
# RUN: perf2bolt %t.dynlib -o %t.fdata4 --pa -p %t.pa-bid \
# RUN: --profile-format=fdata 2>&1 | FileCheck %s --check-prefix=CHECK-NOEXT
# CHECK-NOEXT: PERF2BOLT: filtering pre-aggregated data for buildid aabb1122
# CHECK-NOEXT: BOLT-INFO: 1 out of {{[0-9]+}} functions in the binary
# CHECK-NOEXT-NOT: (0.0%)
#
## Test 5: Check that PIE binaries are not misidentified as shared libraries.
# RUN: perf2bolt %t.exe -o %t.fdata5 --pa -p %t.pa-pie 2>&1 | FileCheck %s \
# RUN: --check-prefix=CHECK-PIE
# CHECK-PIE: BOLT-INFO: 1 out of {{[0-9]+}} functions in the binary