Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/include/llvm/ProfileData/MemProfReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ class MemProfReader {
virtual ~MemProfReader() = default;

// Initialize the MemProfReader with the frame mappings and profile contents.
LLVM_DEPRECATED("Construct MemProfReader with IndexedMemProfData",
"MemProfReader")
MemProfReader(
llvm::DenseMap<FrameId, Frame> FrameIdMap,
llvm::MapVector<GlobalValue::GUID, IndexedMemProfRecord> ProfData);
Expand Down
20 changes: 10 additions & 10 deletions llvm/unittests/ProfileData/MemProfTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,26 +454,26 @@ TEST(MemProf, SymbolizationFilter) {
}

TEST(MemProf, BaseMemProfReader) {
llvm::DenseMap<FrameId, Frame> FrameIdMap;
llvm::memprof::IndexedMemProfData MemProfData;
Frame F1(/*Hash=*/IndexedMemProfRecord::getGUID("foo"), /*LineOffset=*/20,
/*Column=*/5, /*IsInlineFrame=*/true);
Frame F2(/*Hash=*/IndexedMemProfRecord::getGUID("bar"), /*LineOffset=*/10,
/*Column=*/2, /*IsInlineFrame=*/false);
FrameIdMap.insert({F1.hash(), F1});
FrameIdMap.insert({F2.hash(), F2});
MemProfData.Frames.insert({F1.hash(), F1});
MemProfData.Frames.insert({F2.hash(), F2});

llvm::SmallVector<FrameId> CallStack{F1.hash(), F2.hash()};
CallStackId CSId = llvm::memprof::hashCallStack(CallStack);
MemProfData.CallStacks.try_emplace(CSId, CallStack);

llvm::MapVector<llvm::GlobalValue::GUID, IndexedMemProfRecord> ProfData;
IndexedMemProfRecord FakeRecord;
MemInfoBlock Block;
Block.AllocCount = 1U, Block.TotalAccessDensity = 4,
Block.TotalLifetime = 200001;
std::array<FrameId, 2> CallStack{F1.hash(), F2.hash()};
FakeRecord.AllocSites.emplace_back(
/*CS=*/CallStack, /*CSId=*/llvm::memprof::hashCallStack(CallStack),
/*MB=*/Block);
ProfData.insert({F1.hash(), FakeRecord});
FakeRecord.AllocSites.emplace_back(/*CSId=*/CSId, /*MB=*/Block);
MemProfData.Records.insert({F1.hash(), FakeRecord});

MemProfReader Reader(FrameIdMap, ProfData);
MemProfReader Reader(MemProfData);

llvm::SmallVector<MemProfRecord, 1> Records;
for (const auto &KeyRecordPair : Reader) {
Expand Down
Loading