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

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 10:44:16 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
----------------
snehasish wrote:

Same info including column numbers? Can you extend this comment to mention some examples.

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


More information about the llvm-commits mailing list