[llvm] [SampleFDO][TypeProf]Support vtable type profiling for ext-binary and text format (PR #148002)

David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 24 12:53:52 PDT 2025


================
@@ -591,6 +628,59 @@ SampleProfileReaderBinary::readSampleContextFromTable() {
   return std::make_pair(Context, Hash);
 }
 
+std::error_code
+SampleProfileReaderBinary::readVTableTypeCountMap(TypeCountMap &M) {
+  auto NumVTableTypes = readNumber<uint32_t>();
+  if (std::error_code EC = NumVTableTypes.getError())
+    return EC;
+
+  for (uint32_t I = 0; I < *NumVTableTypes; ++I) {
+    auto VTableType(readStringFromTable());
+    if (std::error_code EC = VTableType.getError())
+      return EC;
+
+    auto VTableSamples = readNumber<uint64_t>();
+    if (std::error_code EC = VTableSamples.getError())
+      return EC;
+
+    if (!M.insert(std::make_pair(*VTableType, *VTableSamples)).second)
----------------
david-xl wrote:

is it caused by profile corruption? What actions can be taken by the user when this error is seen?

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


More information about the llvm-commits mailing list