Skip to content

Commit fda80a4

Browse files
[memprof] Use addCallStack in a unit test (NFC) (#119651)
Here IndexedMemProfRecord just needs to reference a CallStackID, so we can use addCallStack for a real hash-based CallStackId instead of a fake value like 0x222.
1 parent 2f8238f commit fda80a4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/unittests/ProfileData/MemProfTest.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,14 +556,12 @@ TEST(MemProf, MissingCallStackId) {
556556
}
557557

558558
TEST(MemProf, MissingFrameId) {
559-
IndexedAllocationInfo AI(0x222, makePartialMIB(), getHotColdSchema());
560-
561-
IndexedMemProfRecord IndexedMR;
562-
IndexedMR.AllocSites.push_back(AI);
563-
564559
// An empty Frame map to trigger a mapping error.
565560
IndexedMemProfData MemProfData;
566-
MemProfData.CallStacks.insert({0x222, {2, 3}});
561+
auto CSId = MemProfData.addCallStack(SmallVector<FrameId>{2, 3});
562+
563+
IndexedMemProfRecord IndexedMR;
564+
IndexedMR.AllocSites.emplace_back(CSId, makePartialMIB(), getHotColdSchema());
567565

568566
FrameIdConverter<decltype(MemProfData.Frames)> FrameIdConv(
569567
MemProfData.Frames);

0 commit comments

Comments
 (0)