Skip to content

Commit ab07c51

Browse files
[memprof] Don't use Frame::hash() (NFC) (#119828)
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.
1 parent 3351b3b commit ab07c51

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/unittests/ProfileData/MemProfTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ TEST(MemProf, BaseMemProfReader) {
422422
Block.AllocCount = 1U, Block.TotalAccessDensity = 4,
423423
Block.TotalLifetime = 200001;
424424
FakeRecord.AllocSites.emplace_back(/*CSId=*/CSId, /*MB=*/Block);
425-
MemProfData.Records.insert({F1.hash(), FakeRecord});
425+
MemProfData.Records.try_emplace(0x1234, std::move(FakeRecord));
426426

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

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

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

0 commit comments

Comments
 (0)