[llvm] [SampleFDO][TypeProf]Support vtable type profiling for ext-binary and text format (PR #148002)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 21 10:54:51 PDT 2025
================
@@ -197,8 +197,32 @@ enum class LineType {
CallSiteProfile,
BodyProfile,
Metadata,
+ VirtualCallTypeProfile,
};
+// Parse `Input` as a white-space separated list of `vtable:count` pairs. An
+// example input line is `_ZTVbar:1471 _ZTVfoo:630`.
+static bool parseTypeCountMap(StringRef Input,
+ DenseMap<StringRef, uint64_t> &TypeCountMap) {
+ for (size_t Index = Input.find_first_not_of(' '); Index != StringRef::npos;) {
+ size_t n1 = Input.find(':', Index);
+ if (n1 == StringRef::npos)
+ return false; // No colon found, invalid format.
----------------
mingmingl-llvm wrote:
Emitting an `llvm::Error` makes sense. Ideally we want to print the error around L422 after calling `ParseLine` (the caller of this `parseTypeCountMap`). May I do this as a follow-up change? Will get to that later today and added a TODO at L417 for now.
https://github.com/llvm/llvm-project/pull/148002
More information about the llvm-commits
mailing list