[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #112655)

Kazu Hirata via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 16 20:34:30 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/112655

None

>From 826b8ad10ef9d24e744aa00298ca380bfcd4c79a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 16 Oct 2024 06:49:47 -0700
Subject: [PATCH] [lldb] Avoid repeated map lookups (NFC)

---
 lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 3e09c316d74f44..70cbd1c57b895a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -5324,7 +5324,7 @@ std::string ProcessGDBRemote::HarmonizeThreadIdsForProfileData(
         std::map<uint64_t, uint32_t>::iterator iterator =
             m_thread_id_to_used_usec_map.find(thread_id);
         if (iterator != m_thread_id_to_used_usec_map.end()) {
-          prev_used_usec = m_thread_id_to_used_usec_map[thread_id];
+          prev_used_usec = iterator->second;
         }
 
         uint32_t real_used_usec = curr_used_usec - prev_used_usec;



More information about the lldb-commits mailing list