[llvm] [ProfData] Improve efficiency of reader (PR #169730)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 26 14:53:00 PST 2025


================
@@ -401,12 +401,27 @@ std::error_code ProfileSymbolList::read(const uint8_t *Data,
   const char *ListStart = reinterpret_cast<const char *>(Data);
   uint64_t Size = 0;
   uint64_t StrNum = 0;
+  uint64_t ExpectedCount = 0;
+
+  // Scan forward to see how many elements we expect.
+  while (Size < ListSize) {
+    if (ListStart[Size] == '\0') ExpectedCount++;
----------------
vitalybuka wrote:

`!=` ?

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


More information about the llvm-commits mailing list