[compiler-rt] [clang-tools-extra] [clang] [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 15:28:38 PST 2023


qiongsiwu wrote:

> > @teresajohnson I mentioned the same thing on [discourse](https://discourse.llvm.org/t/pgo-are-the-llvm-profile-functions-stable-c-apis-across-llvm-releases/75832/5) but it seems like linking on AIX does not support this model.
> 
> I see. Perhaps instead of defining these away completely, they should be defined to a dummy function with the same signature that always returns success (0 I think)? Alternatively, not define them at all when __LLVM_INSTR_PROFILE_GENERATE not defined and have the user guard calls by `#ifdef __LLVM_INSTR_PROFILE_GENERATE`. Otherwise, the user either cannot check the return values, or they have to guard their usage by a check of __LLVM_INSTR_PROFILE_GENERATE anyway.

Ah good catch! Thanks so much! The definitions of `__llvm_profile_dump` and `__llvm_orderfile_dump` are revised to `(0)` so they can be used in `if` conditions. See https://github.com/llvm/llvm-project/pull/76471/commits/cce25f062c00424c153254fc159309808441414c#diff-c21b547d913313490258f0fdb733251d783c5c5a242429ccc2fa5672914f22a2R58. 

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


More information about the cfe-commits mailing list