[llvm] [memprof] Simplify readMemprof (NFC) (PR #119930)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 14:39:01 PST 2024
================
@@ -969,10 +968,20 @@ 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;
- // For the callsites we need to record the index of the associated frame in
- // the frame array (see comments below where the map entries are added).
- std::map<uint64_t, std::set<std::pair<const std::vector<Frame> *, unsigned>>>
- LocHashToCallSites;
+ // A thin wrapper around ArrayRef<Frame> to facilitate std::set<CallStackRef>.
+ struct CallStackRef : public ArrayRef<Frame> {
+ CallStackRef(ArrayRef<Frame> CS, unsigned Pos)
+ : ArrayRef<Frame>(CS.drop_front(Pos)) {}
+ // std::set requires std::less.
----------------
snehasish wrote:
std::set indexing with pointers is inherently unstable. Can we use an unordered container here and simplify this?
https://github.com/llvm/llvm-project/pull/119930
More information about the llvm-commits
mailing list