[llvm] [compiler-rt] [llvm-profdata] Fix binary ids with multiple raw profiles in a single… (PR #72740)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 22:22:20 PST 2023


================
@@ -571,9 +559,20 @@ Error RawInstrProfReader<IntPtrT>::readHeader(
   if (!useCorrelate() && Correlator)
     return error(instrprof_error::unexpected_debug_info_for_correlation);
 
-  BinaryIdsSize = swap(Header.BinaryIdsSize);
-  if (BinaryIdsSize % sizeof(uint64_t))
+  uint64_t BinaryIdsSize = swap(Header.BinaryIdsSize);
+  // Binary ids start just after the header.
+  const uint8_t *BinaryIdsStart =
+      reinterpret_cast<const uint8_t *>(&Header) + sizeof(RawInstrProf::Header);
+  const uint8_t *BinaryIdEnd = BinaryIdsStart + BinaryIdsSize;
----------------
petrhosek wrote:

Can we call it `BinaryIdsEnd` for consistency with `BinaryIdsStart` and `BinaryIdsSize`?

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


More information about the llvm-commits mailing list