aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ProfileData/MemProfTest.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-12-12 07:55:07 -0800
committerGitHub <noreply@github.com>2024-12-12 07:55:07 -0800
commitfda80a4fcad8bab67fc1f522d68012e572866066 (patch)
treedff7f1a0a2bf85243bc10b4f17badc9a8eadf588 /llvm/unittests/ProfileData/MemProfTest.cpp
parent2f8238f849c4836b333082f387d91408234ea73b (diff)
downloadllvm-fda80a4fcad8bab67fc1f522d68012e572866066.zip
llvm-fda80a4fcad8bab67fc1f522d68012e572866066.tar.gz
llvm-fda80a4fcad8bab67fc1f522d68012e572866066.tar.bz2
[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.
Diffstat (limited to 'llvm/unittests/ProfileData/MemProfTest.cpp')
-rw-r--r--llvm/unittests/ProfileData/MemProfTest.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/unittests/ProfileData/MemProfTest.cpp b/llvm/unittests/ProfileData/MemProfTest.cpp
index db69686..dbaf32d 100644
--- a/llvm/unittests/ProfileData/MemProfTest.cpp
+++ b/llvm/unittests/ProfileData/MemProfTest.cpp
@@ -556,14 +556,12 @@ TEST(MemProf, MissingCallStackId) {
}
TEST(MemProf, MissingFrameId) {
- IndexedAllocationInfo AI(0x222, makePartialMIB(), getHotColdSchema());
-
- IndexedMemProfRecord IndexedMR;
- IndexedMR.AllocSites.push_back(AI);
-
// An empty Frame map to trigger a mapping error.
IndexedMemProfData MemProfData;
- MemProfData.CallStacks.insert({0x222, {2, 3}});
+ auto CSId = MemProfData.addCallStack(SmallVector<FrameId>{2, 3});
+
+ IndexedMemProfRecord IndexedMR;
+ IndexedMR.AllocSites.emplace_back(CSId, makePartialMIB(), getHotColdSchema());
FrameIdConverter<decltype(MemProfData.Frames)> FrameIdConv(
MemProfData.Frames);