Files
TheRock/compiler/amd-llvm/compiler-rt/test/profile/Linux/instrprof-instr-suppl.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

87 lines
3.0 KiB
Plaintext

// This is a regression test for supplementary profiles.
// What the test does:
// - Generate raw profiles from an executable and convert it to indexed profiles.
// - Merge indexed profiles with supplementary sample-pgo profiles
// - Check that the block counters for function foo is scaled up.
// REQUIRES: lld-available
// Building the instrumented binary will fail because lld doesn't support
// big-endian ELF for PPC (aka ABI 1).
// ld.lld: error: /lib/../lib64/Scrt1.o: ABI version 1 is not supported
// UNSUPPORTED: ppc && host-byteorder-big-endian
// This compiler-rt test aims to have test coverage for the IRPGO name format
// of local-linkage functions during raw profile generation. The C++ functions
// are simple with little optimization space so test outputs are more stable.
// On the other hand, LLVM tests (like tools/llvm-profdata/suppl-instr-with-sample-static-func.test
// or other suppl* test under tools/llvm-profdata dir) are more suitable for
// more sophisticated cases (e.g., pseudo hot functions or profiles with discriminiators, etc).
// RUN: rm -rf %t && split-file %s %t && cd %t
// Use clangxx_pgogen for IR level instrumentation for C++.
// The test case is constructed such that `-funique-internal-linkage-names` is
// not used in instrPGO but used in static function names in SamplePGO.
// RUN: %clangxx_pgogen -fuse-ld=lld -O2 main.cpp -o main
// RUN: env LLVM_PROFILE_FILE=main.profraw %run ./main
// RUN: llvm-profdata merge main.profraw -o main.profdata
// The function counters are not scaled up.
// RUN: llvm-profdata show -all-functions -counts main.profdata | FileCheck %s --check-prefix=INSTR
// The instrPGO profile counter of function foo should be scaled up. Note the
// scaling factor of a function is computed based on instrPGO profiles and
// invariant to samplePGO profile counters.
// RUN: llvm-profdata merge -supplement-instr-with-sample=sampleprof.proftext \
// RUN: -suppl-min-size-threshold=0 -instr-prof-cold-threshold=1 \
// RUN: main.profdata -o merge.profdata
// RUN: llvm-profdata show -all-functions -counts merge.profdata | FileCheck %s --check-prefix=SUPPL
// INSTR: Counters:
// INSTR: main:
// INSTR: Counters: 1
// INSTR: Block counts: [1]
// INSTR: _Z3barv:
// INSTR: Counters: 1
// INSTR: Block counts: [2]
// INSTR: main.cpp;_ZL3foov:
// INSTR: Counters: 1
// INSTR: Block counts: [1]
// INSTR: Functions shown: 3
// INSTR: Total functions: 3
// SUPPL: Counters:
// SUPPL: main:
// SUPPL: Counters: 1
// SUPPL: Block counts: [1]
// SUPPL: _Z3barv:
// SUPPL: Counters: 1
// SUPPL: Block counts: [2]
// SUPPL: main.cpp;_ZL3foov:
// SUPPL: Counters: 1
// SUPPL: Block counts: [3]
//--- main.cpp
// mark foo and bar as noinline so preinliner won't inlined them into main
// before the instrumentation pass.
__attribute__((noinline)) static void foo() {
}
__attribute__((noinline)) void bar() {
}
int main() {
foo();
bar();
bar();
return 0;
}
//--- sampleprof.proftext
_ZL3foov.__uniq.23343505234642233139497840575431302970:5:5
1: 5