[compiler-rt] [llvm] [InstrPGO][TypeProf]Annotate vtable types when they are present in the profile (PR #99402)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 11:58:19 PDT 2024
================
@@ -1755,8 +1757,18 @@ void PGOUseFunc::annotateValueSites() {
void PGOUseFunc::annotateValueSites(uint32_t Kind) {
assert(Kind <= IPVK_Last);
unsigned ValueSiteIndex = 0;
- auto &ValueSites = FuncInfo.ValueSites[Kind];
unsigned NumValueSites = ProfileRecord.getNumValueSites(Kind);
+ // FuncPGOInstrumentation ctor finds value sites for each kind. It runs on the
+ // common path of pgo-instr-gen and pgo-instr-use, and vtable kind path
+ // is gated by `-enable-vtable-value-profiling`. If vtable profiles are
+ // present, not explicitly discarded and vtable sites remain empty, try to
+ // find the sites again.
+ if (NumValueSites > 0 && Kind == IPVK_VTableTarget &&
+ FuncInfo.ValueSites[Kind].empty() &&
+ !(EnableVTableProfileUse.getNumOccurrences() &&
+ EnableVTableProfileUse == false))
----------------
minglotus-6 wrote:
`EnableVTableProfileUse.getNumOccurrences() && EnableVTableProfileUse == false` meant to allow skipping `VPC.get(IPVK_VTableTarget`. Now this PR uses `-icp-max-num-vtables` to do that.
While adding TODOs to speed up optimized build by skipping `VPC.get(<value-profile-kind>)` if there are no value profiles of this kind in function profile record, I realized `VPC.get(<value-profile-kind>)` for optimized build is necessary to compute function cfg hash with IR and detect profile mismatch.
https://github.com/llvm/llvm-project/pull/99402
More information about the llvm-commits
mailing list