[llvm] [XRay] Avoid repeated hash lookups (NFC) (PR #111786)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 20:12:41 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/111786
None
>From 17b6a5be32c2262fc1e9f50dbac3fab96ead6ce9 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 9 Oct 2024 07:08:49 -0700
Subject: [PATCH] [XRay] Avoid repeated hash lookups (NFC)
---
llvm/lib/XRay/BlockIndexer.cpp | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/XRay/BlockIndexer.cpp b/llvm/lib/XRay/BlockIndexer.cpp
index a99a6815f0d16b..f4ba0eb5bda9cf 100644
--- a/llvm/lib/XRay/BlockIndexer.cpp
+++ b/llvm/lib/XRay/BlockIndexer.cpp
@@ -80,12 +80,9 @@ Error BlockIndexer::visit(FunctionRecord &R) {
}
Error BlockIndexer::flush() {
- Index::iterator It;
- std::tie(It, std::ignore) =
- Indices.insert({{CurrentBlock.ProcessID, CurrentBlock.ThreadID}, {}});
- It->second.push_back({CurrentBlock.ProcessID, CurrentBlock.ThreadID,
- CurrentBlock.WallclockTime,
- std::move(CurrentBlock.Records)});
+ Indices[{CurrentBlock.ProcessID, CurrentBlock.ThreadID}].push_back(
+ {CurrentBlock.ProcessID, CurrentBlock.ThreadID,
+ CurrentBlock.WallclockTime, std::move(CurrentBlock.Records)});
CurrentBlock.ProcessID = 0;
CurrentBlock.ThreadID = 0;
CurrentBlock.Records = {};
More information about the llvm-commits
mailing list