Skip to content

Commit

Permalink
[memprof] Don't use Frame::hash() (NFC) (#119828)
Browse files Browse the repository at this point in the history
In these tests, we just want to add one instance of
IndexedMemProfRecord to MemProfData.Records and retrieve it from
MemProfReader.  There is no particular reason to associate F1.hash()
with the IndexedMemProfRecord instance.  A fake value suffices.

While I am at it, I'm switching to try_emplace so that I can move
FakeRecord.
  • Loading branch information
kazutakahirata authored Dec 13, 2024
1 parent 3351b3b commit ab07c51
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/unittests/ProfileData/MemProfTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ TEST(MemProf, BaseMemProfReader) {
Block.AllocCount = 1U, Block.TotalAccessDensity = 4,
Block.TotalLifetime = 200001;
FakeRecord.AllocSites.emplace_back(/*CSId=*/CSId, /*MB=*/Block);
MemProfData.Records.insert({F1.hash(), FakeRecord});
MemProfData.Records.try_emplace(0x1234, std::move(FakeRecord));

MemProfReader Reader(std::move(MemProfData));

Expand Down Expand Up @@ -454,7 +454,7 @@ TEST(MemProf, BaseMemProfReaderWithCSIdMap) {
Block.AllocCount = 1U, Block.TotalAccessDensity = 4,
Block.TotalLifetime = 200001;
FakeRecord.AllocSites.emplace_back(/*CSId=*/CSId, /*MB=*/Block);
MemProfData.Records.insert({F1.hash(), FakeRecord});
MemProfData.Records.try_emplace(0x1234, std::move(FakeRecord));

MemProfReader Reader(std::move(MemProfData));

Expand Down

0 comments on commit ab07c51

Please sign in to comment.