llvm-project/compiler-rt/test/profile/Linux/instrprof-show-debug-info-correlation.c
Erik Desjardins d768b97424 [Support] change StringMap hash function from djbHash to xxHash
Depends on https://reviews.llvm.org/D142861.

Alternative to https://reviews.llvm.org/D137601.

xxHash is much faster than djbHash. This makes a simple Rust test case with a large constant string 10% faster to compile.

Previous attempts at changing this hash function (e.g. https://reviews.llvm.org/D97396) had to be reverted due to breaking tests that depended on iteration order.
No additional tests fail with this patch compared to `main` when running `check-all` with `-DLLVM_ENABLE_PROJECTS="all"` (on a Linux host), so I hope I found everything that needs to be changed.

Differential Revision: https://reviews.llvm.org/D142862
2023-02-07 22:55:41 -05:00

42 lines
1.5 KiB
C

// RUN: %clang_pgogen -o %t -g -mllvm --debug-info-correlate -mllvm --disable-vp=true %s
// RUN: llvm-profdata show --debug-info=%t --detailed-summary --show-prof-sym-list | FileCheck %s
// RUN: llvm-profdata show --debug-info=%t --show-format=yaml | FileCheck %s --match-full-lines --check-prefix YAML
// RUN: %clang_pgogen -o %t.no.dbg -mllvm --debug-info-correlate -mllvm --disable-vp=true %s
// RUN: not llvm-profdata show --debug-info=%t.no.dbg 2>&1 | FileCheck %s --check-prefix NO-DBG
// NO-DBG: unable to correlate profile: could not find any profile metadata in debug info
// YAML: Probes:
// YAML: - Function Name: a
// YAML: Linkage Name: a
// YAML: CFG Hash: 0x[[#%.1X,HASH:]]
// YAML: Counter Offset: 0x0
// YAML: Num Counters: 1
// YAML: File: [[FILE:'.*']]
// YAML: Line: [[@LINE+1]]
void a() {}
// YAML: - Function Name: b
// YAML: Linkage Name: b
// YAML: CFG Hash: 0x[[#%.1X,HASH:]]
// YAML: Counter Offset: 0x8
// YAML: Num Counters: 1
// YAML: File: [[FILE:'.*']]
// YAML: Line: [[@LINE+1]]
void b() {}
// YAML: - Function Name: main
// YAML: Linkage Name: main
// YAML: CFG Hash: 0x[[#%.1X,HASH:]]
// YAML: Counter Offset: 0x10
// YAML: Num Counters: 1
// YAML: File: [[FILE]]
// YAML: Line: [[@LINE+1]]
int main() { return 0; }
// CHECK: main
// CHECK: a
// CHECK: b
// CHECK: Counters section size: 0x18 bytes
// CHECK: Found 3 functions