================ @@ -821,15 +822,23 @@ void InstrProfRecord::merge(InstrProfRecord &Other, uint64_t Weight, for (size_t I = 0, E = Other.Counts.size(); I < E; ++I) { bool Overflowed; - uint64_t Value = - SaturatingMultiplyAdd(Other.Counts[I], Weight, Counts[I], &Overflowed); - if (Value > getInstrMaxCountValue()) { - Value = getInstrMaxCountValue(); - Overflowed = true; + uint64_t Value; + // When a profile has single byte coverage, use || to merge counters. + if (HasSingleByteCoverage) + Value = Other.Counts[I] || Counts[I]; ---------------- gulfemsavrun wrote:
Yes, this is to make sure that we only write 0s or 1s into indexed profiles when we use single byte counters mode. re: "In addition, indexed profiles would have more information because if a counter is large, we know it is commonly executed because it was covered in many raw profiles.": Do you have a use case for this? Unless there is a use case, I prefer the values in raw profiles and indexed profiles to be consistent. Otherwise, it might be cause confusion and difficulty in debugging. Currently, we only explored single byte counter in raw profiles. If there is any benefit, we can also explore using single byte counters in the indexed profiles. https://github.com/llvm/llvm-project/pull/75425 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits