[compiler-rt] [llvm] [InstrPGO][TypeProf]Annotate vtable types when they are present in the profile (PR #99402)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 10:04:05 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))
----------------
teresajohnson wrote:

Why does this need to depend on whether we are using it in the optimization passes? Won't we then get matching warnings if someone disables that?

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


More information about the llvm-commits mailing list