================
@@ -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];
----------------
ellishg wrote:
Yes, we actually do use block coverage to collect many raw profiles and 
aggregate them into an indexed profile. Since the counts can be larger than 
one, it helps differentiate between some hot and cold blocks during 
optimization.

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

Reply via email to