[llvm] [XRay] Avoid repeated hash lookups (NFC) (PR #111786)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 20:13:17 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-xray
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/111786.diff
1 Files Affected:
- (modified) llvm/lib/XRay/BlockIndexer.cpp (+3-6)
``````````diff
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 = {};
``````````
</details>
https://github.com/llvm/llvm-project/pull/111786
More information about the llvm-commits
mailing list