[llvm] [MemProf] Track and report profiled sizes through cloning (PR #98382)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 18:04:05 PDT 2024


================
@@ -2261,6 +2285,30 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::print(
   }
 }
 
+template <typename DerivedCCG, typename FuncTy, typename CallTy>
+void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::printTotalSizes(
+    raw_ostream &OS) const {
+  using GraphType = const CallsiteContextGraph<DerivedCCG, FuncTy, CallTy> *;
+  for (const auto Node : nodes<GraphType>(this)) {
+    if (Node->isRemoved())
+      continue;
+    if (!Node->IsAllocation)
+      continue;
+    auto ContextIds = Node->getContextIds();
----------------
snehasish wrote:

Should we use a reference to avoid a copy? Also spelling out the type would be helpful in reasoning about the usage.

https://github.com/llvm/llvm-project/pull/98382


More information about the llvm-commits mailing list