aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ProfileData/MemProfTest.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-12-04 20:33:35 -0800
committerGitHub <noreply@github.com>2024-12-04 20:33:35 -0800
commit50f8580e2cded758627b8d9478b56d5443aa6d7c (patch)
tree8d9e7e9ddfda6fbc50e7df4ed6f0c6b1d84d62ba /llvm/unittests/ProfileData/MemProfTest.cpp
parent7f72d71de7c3b7d36d9f463b1459a6d2f6c989e6 (diff)
downloadllvm-50f8580e2cded758627b8d9478b56d5443aa6d7c.zip
llvm-50f8580e2cded758627b8d9478b56d5443aa6d7c.tar.gz
llvm-50f8580e2cded758627b8d9478b56d5443aa6d7c.tar.bz2
[memprof] Add IndexedMemProfData::addFrame (#118724)
This patch adds a helper function to replace an idiom like: FrameId Id = F.hash(); MemProfData.Frames.try_emplace(Id, F); // Do something with Id.
Diffstat (limited to 'llvm/unittests/ProfileData/MemProfTest.cpp')
-rw-r--r--llvm/unittests/ProfileData/MemProfTest.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/unittests/ProfileData/MemProfTest.cpp b/llvm/unittests/ProfileData/MemProfTest.cpp
index 83383ee..99f95dd 100644
--- a/llvm/unittests/ProfileData/MemProfTest.cpp
+++ b/llvm/unittests/ProfileData/MemProfTest.cpp
@@ -430,8 +430,8 @@ TEST(MemProf, BaseMemProfReader) {
/*Column=*/5, /*IsInlineFrame=*/true);
Frame F2(/*Hash=*/IndexedMemProfRecord::getGUID("bar"), /*LineOffset=*/10,
/*Column=*/2, /*IsInlineFrame=*/false);
- MemProfData.Frames.insert({F1.hash(), F1});
- MemProfData.Frames.insert({F2.hash(), F2});
+ MemProfData.addFrame(F1);
+ MemProfData.addFrame(F2);
llvm::SmallVector<FrameId> CallStack{F1.hash(), F2.hash()};
CallStackId CSId = hashCallStack(CallStack);
@@ -466,8 +466,8 @@ TEST(MemProf, BaseMemProfReaderWithCSIdMap) {
/*Column=*/5, /*IsInlineFrame=*/true);
Frame F2(/*Hash=*/IndexedMemProfRecord::getGUID("bar"), /*LineOffset=*/10,
/*Column=*/2, /*IsInlineFrame=*/false);
- MemProfData.Frames.insert({F1.hash(), F1});
- MemProfData.Frames.insert({F2.hash(), F2});
+ MemProfData.addFrame(F1);
+ MemProfData.addFrame(F2);
llvm::SmallVector<FrameId> CallStack = {F1.hash(), F2.hash()};
CallStackId CSId = hashCallStack(CallStack);