[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
Mon Jul 22 10:05:56 PDT 2024
================
@@ -1755,8 +1757,22 @@ 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);
+
+ // Since there isn't a reliable or fast way for profile reader to tell if a
+ // profile is generated with `-enable-vtable-value-profiling` on, we run the
+ // value profile collector over the function IR to find the instrumented sites
+ // iff function profile records shows the number of instrumented vtable sites
+ // is not zero. Function cfg already takes the number of instrumented
+ // indirect call sites into account so it doesn't hash the number of
+ // instrumented vtables; as a side effect it makes it easier to enable
+ // profiling and profile use in two steps if needed.
+ if (NumValueSites > 0 && Kind == IPVK_VTableTarget &&
----------------
minglotus-6 wrote:
done.
https://github.com/llvm/llvm-project/pull/99402
More information about the llvm-commits
mailing list