[PATCH] D22983: [lldb][tsan] Perform one map lookup instead of two (NFC)

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 17:12:15 PDT 2016


vsk created this revision.
vsk added a reviewer: kubabrecka.
vsk added a subscriber: llvm-commits.

https://reviews.llvm.org/D22983

Files:
  source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp

Index: source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
===================================================================
--- source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
+++ source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
@@ -335,10 +335,11 @@
 }
 
 static user_id_t Renumber(uint64_t id, std::map<uint64_t, user_id_t> &thread_id_map) {
-    if (! thread_id_map.count(id))
+    auto IT = thread_id_map.find(id);
+    if (IT == thread_id_map.end())
         return 0;
     
-    return thread_id_map[id];
+    return IT->second;
 }
 
 StructuredData::ObjectSP


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22983.66200.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160730/b422a03c/attachment.bin>


More information about the llvm-commits mailing list