[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
================
@@ -1031,15 +1072,32 @@ readMemprof(Module &M, Function &F, IndexedInstrProfReader *MemProfReader,
// Build maps of the location hash to all profile data with that leaf location
// (allocation info and the callsites).
std::map<uint64_t, std::set<const AllocationInfo *>> LocHashToAllocInfo;
- // A hash function for std::unordered_set<ArrayRef<Frame>> to work.
- struct CallStackHash {
- size_t operator()(ArrayRef<Frame> CS) const {
- return computeFullStackId(CS);
+
+ // Helper struct for maintaining refs to callsite data. As an alternative we
+ // could store a pointer to the CallSiteInfo struct but we also need the frame
+ // index. Using ArrayRefs instead makes it a little easier to read.
+ struct CallSiteEntry {
+ // Subset of frames for the corresponding CallSiteInfo.
+ ArrayRef<Frame> Frames;
+ // Potential targets for indirect calls.
+ ArrayRef<GlobalValue::GUID> CalleeGuids;
+
+ // Only compare Frame contents.
----------------
snehasish wrote:
Yes, added comment. It's also faster this way.
https://github.com/llvm/llvm-project/pull/141164
More information about the llvm-commits
mailing list