[compiler-rt] [llvm] [InstrProf] Add debuginfod correlation support (PR #106606)

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 16:49:10 PDT 2024


================
@@ -0,0 +1,27 @@
+// REQUIRES: linux || windows
+// RUN: rm -rf %t
+
+// Default build with no profile correlation.
+// RUN: %clang_profgen -o %t.default.exe -Wl,--build-id=0x12345678 -fprofile-instr-generate -fcoverage-mapping %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp
+// RUN: env LLVM_PROFILE_FILE=%t.default.profraw %run %t.default.exe
+// RUN: llvm-profdata merge -o %t.default.profdata %t.default.profraw
+
+// Build with profile binary correlation and test llvm-profdata merge profile correlation with --binary-file option.
+// RUN: %clang_profgen -o %t.correlate.exe -Wl,--build-id=0x12345678 -fprofile-instr-generate -fcoverage-mapping -mllvm -profile-correlate=binary %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp
+// Strip above binary and run
+// RUN: llvm-strip %t.correlate.exe -o %t.stripped.exe
+// RUN: env LLVM_PROFILE_FILE=%t.correlate.profraw %run %t.stripped.exe
+// RUN: llvm-profdata merge -o %t.correlate-binary.profdata --binary-file=%t.correlate.exe %t.correlate.profraw
+// RUN: diff %t.default.profdata %t.correlate-binary.profdata
----------------
ZequanWu wrote:

I found this to be fragile on windows if comparing two profile data directly. I would suggest using:
```
llvm-profdata show ... > profdata.show.1
llvm-profdata show ... > profdata.show.2
diff profdata.show.1 profdata.show.2
```

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


More information about the llvm-commits mailing list