[PATCH] D14547: [llvm-profdata] Add support for weighted merge of profile data

Nathan Slingerland via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 15:16:32 PST 2015


slingn added inline comments.

================
Comment at: include/llvm/ProfileData/InstrProf.h:445
@@ +444,3 @@
+    uint64_t OtherCount = Other.Counts[I];
+    if (Weight > 1) {
+      OtherCount = SaturatingMultiply(OtherCount, Weight, ResultOverflowed);
----------------
davidxl wrote:
> It might be better to refactor the 'fused' Multiple/Add into a helper -- it is used in two different places.
That sounds like a good idea. I'll do that in a separate change.

================
Comment at: include/llvm/ProfileData/SampleProf.h:239
@@ +238,3 @@
+      Num = SaturatingMultiply(Num, Weight);
+    TotalSamples += Num;
+  }
----------------
davidxl wrote:
> Why is SaturatingAdd not used here?
Good question. I'll make that change in a separate patch since it is changing the existing semantics and should have its own unit tests.


http://reviews.llvm.org/D14547





More information about the llvm-commits mailing list