[llvm] fda80a4 - [memprof] Use addCallStack in a unit test (NFC) (#119651)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 12 07:55:11 PST 2024
Author: Kazu Hirata
Date: 2024-12-12T07:55:07-08:00
New Revision: fda80a4fcad8bab67fc1f522d68012e572866066
URL: https://github.com/llvm/llvm-project/commit/fda80a4fcad8bab67fc1f522d68012e572866066
DIFF: https://github.com/llvm/llvm-project/commit/fda80a4fcad8bab67fc1f522d68012e572866066.diff
LOG: [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.
Added:
Modified:
llvm/unittests/ProfileData/MemProfTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/ProfileData/MemProfTest.cpp b/llvm/unittests/ProfileData/MemProfTest.cpp
index db69686a7694fd..dbaf32dd1d749b 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);
More information about the llvm-commits
mailing list