[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 12:02:24 PDT 2025


================
@@ -1209,6 +1209,41 @@ readMemprof(Module &M, Function &F, IndexedInstrProfReader *MemProfReader,
                                                InlinedCallStack)) {
           NumOfMemProfMatchedCallSites++;
           addCallsiteMetadata(I, InlinedCallStack, Ctx);
+
+          // Check if this is an indirect call and we have GUID information
+          // from CallSiteInfo to attach value profile metadata
+          if (!CalledFunction) {
+            // This is an indirect call, look for CallSites with matching stacks
+            // that have CalleeGuids information
+            for (auto &CS : MemProfRec->CallSites) {
----------------
snehasish wrote:

Yes, though I used ArrayRefs instead of a pointer since we needed to store the frame index too.

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


More information about the llvm-commits mailing list