[llvm] [compiler-rt] [llvm-profdata] Fix binary ids with multiple raw profiles in a single… (PR #72740)
    Zequan Wu via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Nov 20 07:40:04 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;
----------------
ZequanWu wrote:
Renamed `BinaryIdsStart` and `BinaryIdsSize` to `BinaryIdStart` and `BinaryIdSize` because there can only be up to one binary id after the header.
https://github.com/llvm/llvm-project/pull/72740
    
    
More information about the llvm-commits
mailing list