[llvm] [MemProf] Make sure call clones without callsite node clones get updated (PR #159861)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 20 18:28:22 PDT 2025


================
@@ -5047,6 +5132,25 @@ bool CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::assignFunctions() {
     // Update all the matching calls as well.
     for (auto &Call : Node->MatchingCalls)
       updateCall(Call, CalleeFunc);
+
+    // Now update all calls recorded earlier that are still in function clones
+    // which don't have a clone of this callsite node.
+    if (!UnassignedCallClones.contains(Node))
+      return;
+    DenseSet<unsigned> NodeCallClones;
+    for (auto *C : Node->Clones)
+      NodeCallClones.insert(C->Call.cloneNo());
+    auto &ClonedCalls = UnassignedCallClones[Node];
----------------
snehasish wrote:

nit: `UnassignedCallClones.at(Node)` to ensure we don't insert a new element accidentally.

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


More information about the llvm-commits mailing list