[PATCH] D96990: [CSSPGO] Use callsite sample counts to annotate indirect call sites.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 13:03:10 PST 2021


hoy updated this revision to Diff 324747.
hoy added a comment.

Fixing clang-tidy issues.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96990

Files:
  llvm/lib/Transforms/IPO/SampleProfile.cpp


Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1248,8 +1248,19 @@
           }
           SmallVector<InstrProfValueData, 2> SortedCallTargets =
               GetSortedValueDataFromCallTargets(T.get());
-          uint64_t Sum;
-          findIndirectCallFunctionSamples(I, Sum);
+          uint64_t Sum = 0;
+          for (const auto &C : T.get())
+            Sum += C.second;
+          // With CSSPGO all indirect call targets are counted torwards the
+          // original indirect call site in the profile, including both
+          // inlined and non-inlined targets.
+          if (!FunctionSamples::ProfileIsCS) {
+            if (const FunctionSamplesMap *M =
+                    FS->findFunctionSamplesMapAt(CallSite)) {
+              for (const auto &NameFS : *M)
+                Sum += NameFS.second.getEntrySamples();
+            }
+          }
           annotateValueSite(*I.getParent()->getParent()->getParent(), I,
                             SortedCallTargets, Sum, IPVK_IndirectCallTarget,
                             SortedCallTargets.size());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96990.324747.patch
Type: text/x-patch
Size: 1240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210218/46251c4f/attachment.bin>


More information about the llvm-commits mailing list