[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:32 PDT 2024
================
@@ -0,0 +1,47 @@
+// UNSUPPORTED: target={{.*windows.*}}
+// This test is derived from "compiler-rt/test/profile/instrprof-write-buffer-internal.c",
----------------
minglotus-6 wrote:
Hmm, I added `threadFunc` [1] to `compiler-rt/test/profile/instrprof-write-buffer-internal.c` without the non-test code changes in this patch, and `llvm-profdata show` can parse the profiles [2].
On the other hand, without the non-test code changes I can see profile truncate error for this test case. I need to dig and find an explanation for that. Meanwhile let me know if you happen to have a theory already.
[1]
```
diff --git a/compiler-rt/test/profile/instrprof-write-buffer-internal.c b/compiler-rt/test/profile/instrprof-write-buffer-internal.c
index 2c1c29ac0c58..a610abca2495 100644
--- a/compiler-rt/test/profile/instrprof-write-buffer-internal.c
+++ b/compiler-rt/test/profile/instrprof-write-buffer-internal.c
@@ -41,6 +41,12 @@ int __llvm_profile_write_buffer_internal(
void __llvm_profile_set_dumped(void);
+void threadFunc(void *callback) // Needed for failure.
+{
+ typedef void(FuncPtr)();
+ (*(FuncPtr *)callback)();
+}
+
int main(int argc, const char *argv[]) {
uint64_t bufsize = __llvm_profile_get_size_for_buffer_internal(
__llvm_profile_begin_data(), __llvm_profile_end_data(),
```
[2]
```
bin/llvm-profdata show /path/to/instrprof-write-buffer-internal.c.tmp.buf.profraw
```
https://github.com/llvm/llvm-project/pull/97350
More information about the llvm-commits
mailing list