[compiler-rt] [clang-tools-extra] [clang] [PGO] Exposing PGO's Counter Reset and File Dumping APIs (PR #76471)

Qiongsi Wu via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 27 15:26:42 PST 2023


================
@@ -100,12 +103,6 @@ ValueProfNode *__llvm_profile_begin_vnodes();
 ValueProfNode *__llvm_profile_end_vnodes();
 uint32_t *__llvm_profile_begin_orderfile();
 
-/*!
- * \brief Clear profile counters to zero.
- *
- */
-void __llvm_profile_reset_counters(void);
----------------
qiongsiwu wrote:

> Ok, if we don't want to expose the internals then the existing approach seems like the simplest one. I think @davidxl's comment in the discourse thread is about ensuring no control flow changes in profile gen and use in hot code paths. This does not necessarily preclude additional wrappers.
> 
> > Update: I think the explicit definition needs to be guarded by an #ifndef.
> 
> Yes, I misread the original as `#ifdef` causing some confusion. This should also be `#undef` afterwards. I was thinking about churn for existing users of InstrProfiling.h but it should be a no-op.

Ah got it! Thanks so much for the clarification! `InstrProfiling.h` is updated so we are guarding `__LLVM_INSTR_PROFILE_GENERATE`'s macro definition. 

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


More information about the llvm-commits mailing list