[clang] [compiler-rt] [llvm] [InstrProf] Single byte counters in coverage (PR #75425)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 14:44:58 PST 2024


================
@@ -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:

I'm actually surprised this doesn't break any tests. If not, then I might need to add some more.

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


More information about the llvm-commits mailing list