[llvm] [PGO] Sampled instrumentation in PGO to speed up instrumentation binary (PR #69535)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 16:55:33 PDT 2023
================
@@ -412,30 +424,91 @@ PreservedAnalyses InstrProfiling::run(Module &M, ModuleAnalysisManager &AM) {
return PreservedAnalyses::none();
}
+// Perform instrumentation sampling.
+// We transform:
+// Increment_Instruction;
+// to:
+// if (__llvm_profile_sampling__ <= SampleDuration) {
+// Increment_Instruction;
+// }
+// __llvm_profile_sampling__ += 1;
----------------
WenleiHe wrote:
Agree with what @snehasish said. Why not record once for every N hits? firstN of 64K is more prone to synchronization issues (with the program).
https://github.com/llvm/llvm-project/pull/69535
More information about the llvm-commits
mailing list