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

David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 15:35:19 PST 2015


davidxl 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);
----------------
It might be better to refactor the 'fused' Multiple/Add into a helper -- it is used in two different places.

================
Comment at: include/llvm/ProfileData/SampleProf.h:239
@@ +238,3 @@
+      Num = SaturatingMultiply(Num, Weight);
+    TotalSamples += Num;
+  }
----------------
Why is SaturatingAdd not used here?

================
Comment at: include/llvm/ProfileData/SampleProf.h:245
@@ +244,3 @@
+    TotalHeadSamples += Num;
+  }
+  void addBodySamples(uint32_t LineOffset, uint32_t Discriminator, uint64_t Num,
----------------
Same here.


http://reviews.llvm.org/D14547





More information about the llvm-commits mailing list