[llvm] [MemProf] Ensure all callsite clones are assigned a function clone (PR #150735)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 26 10:43:50 PDT 2025


================
@@ -3995,7 +4024,19 @@ void IndexCallsiteContextGraph::updateCall(CallInfo &CallerCall,
   assert(CI &&
          "Caller cannot be an allocation which should not have profiled calls");
   assert(CI->Clones.size() > CallerCall.cloneNo());
-  CI->Clones[CallerCall.cloneNo()] = CalleeFunc.cloneNo();
+  auto NewCalleeCloneNo = CalleeFunc.cloneNo();
+  auto CurCalleeCloneNo = CI->Clones[CallerCall.cloneNo()];
----------------
snehasish wrote:

If we use `.find()` here and check the iterator below, then the update won't need to lookup the map again. This also avoids inserting an entry where none existed, though that should be benign since we overwrite it soon after.

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


More information about the llvm-commits mailing list