[llvm] [MemProf] Ensure all callsite clones are assigned a function clone (PR #150735)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 27 10:37:31 PDT 2025
================
@@ -2060,6 +2062,20 @@ static bool isMemProfClone(const Function &F) {
return F.getName().contains(MemProfCloneSuffix);
}
+// Return the clone number of the given function by extracting it from the
+// memprof suffix. Assumes the caller has already confirmed it is a memprof
+// clone.
+static unsigned getMemProfCloneNum(const Function &F) {
+ assert(isMemProfClone(F));
+ auto Pos = F.getName().find_last_of('.');
+ assert(Pos > 0);
+ unsigned CloneNo;
+ auto Error = F.getName().drop_front(Pos + 1).getAsInteger(10, CloneNo);
----------------
snehasish wrote:
nit: bool instead of auto since (to avoid confusion since Error is a class in LLVM).
https://github.com/llvm/llvm-project/pull/150735
More information about the llvm-commits
mailing list