[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


================
@@ -964,6 +970,41 @@ undriftMemProfRecord(const DenseMap<uint64_t, LocToLocMap> &UndriftMaps,
     UndriftCallStack(CS.Frames);
 }
 
+// Helper function to process CalleeGuids and create value profile metadata
+static void addVPMetadata(Module &M, Instruction &I,
+                          ArrayRef<GlobalValue::GUID> CalleeGuids) {
+  if (!ClMemProfAttachCalleeGuids || CalleeGuids.empty())
+    return;
+
+  if (I.getMetadata(LLVMContext::MD_prof)) {
+    uint64_t Unused;
+    auto ExistingVD =
+        getValueProfDataFromInst(I, IPVK_IndirectCallTarget, ~0U, Unused);
----------------
snehasish wrote:

Done.

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


More information about the llvm-commits mailing list