[PATCH] D122609: [llvm-profgen] Update callsite body samples by summing up all call target samples.

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 23:45:55 PDT 2022


wenlei added inline comments.


================
Comment at: llvm/include/llvm/ProfileData/SampleProf.h:28
 #include <algorithm>
+#include <bits/stdint-uintn.h>
 #include <cstdint>
----------------
what triggered this change? 


================
Comment at: llvm/include/llvm/ProfileData/SampleProf.h:751
+      uint64_t TargetSamples = I.second.getCallTargetSamples();
+      if (TargetSamples > I.second.getSamples())
+        I.second.addSamples(TargetSamples - I.second.getSamples());
----------------
hoy wrote:
> wenlei wrote:
> > > LBR ranges is formed from two consecutive branch samples. Therefore the last entry in a LBR record will not be counted towards body samples while there's still a chance for it to be counted towards call targets if it is a function call 
> > 
> > Based on this theory, is it actually possible for `I.second.getSamples()` to be larger than `TargetSamples`? 
> Actually it is possible. If some call targets are external targets, they won't be counted, but the body sample count which is from the lbr ranges can include them. 
Ok, add a comment?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122609/new/

https://reviews.llvm.org/D122609



More information about the llvm-commits mailing list