[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


================
@@ -4703,6 +4744,18 @@ bool CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::assignFunctions() {
           // where the callers were assigned to different clones of a function.
         }
 
+        auto FindFirstAvailFuncClone = [&]() {
+          // Find first function in FuncClonesToCallMap without an assigned
+          // clone of this callsite Node. We should always have one
+          // available at this point due to the earlier cloning when the
+          // FuncClonesToCallMap size was smaller than the clone number.
+          for (auto &CF : FuncClonesToCallMap) {
+            if (!FuncCloneToCurNodeCloneMap.count(CF.first))
+              return CF.first;
+          }
+          assert(false);
----------------
snehasish wrote:

Add a message to explain what happened when this assert fails?

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


More information about the llvm-commits mailing list