[llvm] [MemProf] Attach value profile metadata to the IR using CalleeGuids. (PR #141164)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri May 30 22:32:16 PDT 2025


================
@@ -1202,13 +1262,19 @@ readMemprof(Module &M, Function &F, IndexedInstrProfReader *MemProfReader,
       // Otherwise, add callsite metadata. If we reach here then we found the
       // instruction's leaf location in the callsites map and not the allocation
       // map.
-      for (auto CallStackIdx : CallSitesIter->second) {
+      for (const auto &CallSiteEntry : CallSitesIter->second) {
         // If we found and thus matched all frames on the call, create and
         // attach call stack metadata.
-        if (stackFrameIncludesInlinedCallStack(CallStackIdx,
+        if (stackFrameIncludesInlinedCallStack(CallSiteEntry.Frames,
                                                InlinedCallStack)) {
           NumOfMemProfMatchedCallSites++;
           addCallsiteMetadata(I, InlinedCallStack, Ctx);
+
+          // Try to attach indirect call metadata if possible.
+          if (!CalledFunction) {
----------------
snehasish wrote:

Done.

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


More information about the llvm-commits mailing list