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

Qiongsi Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 27 14:16:56 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:

> They are effectively removed if the frontend does not define __LLVM_INSTR_PROFILE_GENERATE (see my other comment).

`__LLVM_INSTR_PROFILE_GENERATE` is defined explicitly in this header `compiler-rt/lib/profile/InstrProfiling.h` before the new header is included (see https://github.com/llvm/llvm-project/pull/76471/files#diff-4de780ce726d76b7abc9d3353aef95013e7b21e7bda01be8940cc6574fb0b5ffR15) so that we do not depend on the frontend for the macro in the compiler-rt context, and we make sure that these three names are always available (regardless of frontend options). 

I am trying to avoid wrappers or duplicating definitions. [This comment](https://discourse.llvm.org/t/pgo-are-the-llvm-profile-functions-stable-c-apis-across-llvm-releases/75832/7?u=qwu_ibm) seem to imply that creating wrapper or duplicating definition is not desirable. However, if avoiding wrapper or duplication is making downstream code unnecessarily complicated, I will create the wrappers instead. 

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


More information about the cfe-commits mailing list