[PATCH] D83852: [llvm-profdata] Implement llvm-profdata overlap for sample profiles

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 00:19:42 PDT 2020


hoyFB added inline comments.


================
Comment at: llvm/tools/llvm-profdata/llvm-profdata.cpp:858
+  /// This function updates sample overlap statistics of an overlap function in
+  /// base and test profile. It also calculates a function-internal similarity
+  /// FIS as follows:
----------------
function-level similarity? 


================
Comment at: llvm/tools/llvm-profdata/llvm-profdata.cpp:1048
+  for (const auto &F : BaseHotFunc) {
+    const auto &Match = TestHotFunc.find(F.first());
+    if (Match == TestHotFunc.end())
----------------
I think you want just `const auto Match = ...`.  The return value will be returned by reference if it is large.


================
Comment at: llvm/tools/llvm-profdata/llvm-profdata.cpp:1050
+    if (Match == TestHotFunc.end())
+      continue;
+
----------------
May just increase `HotFuncOverlap.UnionCount` before continue, instead of erasing every matched function from `TestHotFunc`? like


```
for (const auto &F : TestHotFunc) {
    if (BaseHotFunc.count(F.first()))
       ++HotFuncOverlap.OverlapCount;
    else
       ++HotFuncOverlap.UnionCount;
}
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83852





More information about the llvm-commits mailing list