[llvm] Reapply "[MemProf] Reduce cloning overhead by sharing nodes when possible" (#102932) with fixes (PR #106623)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 16:39:39 PDT 2024


================
@@ -1892,35 +1899,86 @@ void CallsiteContextGraph<DerivedCCG, FuncTy,
   // from the profiled contexts.
   MapVector<CallInfo, ContextNode *> TailCallToContextNodeMap;
 
+  std::vector<std::pair<CallInfo, ContextNode *>> NewCallToNode;
   for (auto &Entry : NonAllocationCallToContextNodeMap) {
     auto *Node = Entry.second;
     assert(Node->Clones.empty());
     // Check all node callees and see if in the same function.
-    auto Call = Node->Call.call();
-    for (auto EI = Node->CalleeEdges.begin(); EI != Node->CalleeEdges.end();
-         ++EI) {
-      auto Edge = *EI;
-      if (!Edge->Callee->hasCall())
-        continue;
-      assert(NodeToCallingFunc.count(Edge->Callee));
-      // Check if the called function matches that of the callee node.
-      if (calleesMatch(Call, EI, TailCallToContextNodeMap))
-        continue;
+    // We need to check all of the calls recorded in this Node, because in some
+    // cases we may have had multiple calls with the same debug info calling
----------------
teresajohnson wrote:

yes. I added some details for the case I saw to the comment.

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


More information about the llvm-commits mailing list