[llvm] 35bbfbc - [XRay] Simplify code with DenseMap::operator[] (NFC) (#111786)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 08:18:03 PDT 2024


Author: Kazu Hirata
Date: 2024-10-10T08:17:58-07:00
New Revision: 35bbfbc7c0d0782bad5160662c9683b38329c7c1

URL: https://github.com/llvm/llvm-project/commit/35bbfbc7c0d0782bad5160662c9683b38329c7c1
DIFF: https://github.com/llvm/llvm-project/commit/35bbfbc7c0d0782bad5160662c9683b38329c7c1.diff

LOG: [XRay] Simplify code with DenseMap::operator[] (NFC) (#111786)

Added: 
    

Modified: 
    llvm/lib/XRay/BlockIndexer.cpp

Removed: 
    


################################################################################
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