[compiler-rt] Fixed __llvm_profile_write_buffer in presence of ValueProfileData. (PR #97350)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 17:24:34 PDT 2024


================
@@ -0,0 +1,42 @@
+// UNSUPPORTED: target={{.*windows.*}}
+// This test is derived from "compiler-rt/test/profile/instrprof-write-buffer-internal.c",
+// and that test was disabled on Windows due to sanitizer-windows bot failures.
+// Doing the same here. See 2fcc3f4b18.
+//
+// RUN: rm -f %t.buf.profraw
----------------
minglotus-6 wrote:

I patched this PR and I can see `llvm-profdata show` returns `truncated profile data` without the code change.

Suggest to show some function counters. For instance, `--all-functions -counts -ic-targets` which gives the output below. `--function=main` should limit function counters to `main`.

```
./bin/llvm-profdata show --all-functions --counts -ic-targets /path/to/instrprof-write-buffer.c.tmp.buf.profraw
Counters:
  threadFunc:
    Hash: 0x025f5c817fffffff
    Counters: 1
    Indirect Call Site Count: 1
    Block counts: [0]
    Indirect Target Results:
  main:
    Hash: 0x0209aa3e3852da94
    Counters: 2
    Indirect Call Site Count: 0
    Block counts: [0, 0]
    Indirect Target Results:
Instrumentation level: IR  entry_first = 0
Functions shown: 2
Total functions: 2
Maximum function count: 0
Maximum internal block count: 0
Statistics for indirect call sites profile:
  Total number of sites: 1
  Total number of sites with values: 0
  Total number of profiled values: 0
  Value sites histogram:
	NumTargets, SiteCount
```

https://github.com/llvm/llvm-project/pull/97350


More information about the llvm-commits mailing list