[llvm] 157adcc - [GSYM] Avoid repeated hash lookups (NFC) (#109241)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 09:14:48 PDT 2024


Author: Kazu Hirata
Date: 2024-09-19T09:14:45-07:00
New Revision: 157adcccc59cbadd6f579418eac9e7dafa38ceec

URL: https://github.com/llvm/llvm-project/commit/157adcccc59cbadd6f579418eac9e7dafa38ceec
DIFF: https://github.com/llvm/llvm-project/commit/157adcccc59cbadd6f579418eac9e7dafa38ceec.diff

LOG: [GSYM] Avoid repeated hash lookups (NFC) (#109241)

Added: 
    

Modified: 
    llvm/lib/DebugInfo/GSYM/GsymCreator.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
index 0418e3258a16bf..3227fa5400fb5c 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
@@ -375,8 +375,7 @@ uint32_t GsymCreator::insertString(StringRef S, bool Copy) {
   // Save a mapping of string offsets to the cached string reference in case
   // we need to segment the GSYM file and copy string from one string table to
   // another.
-  if (StringOffsetMap.count(StrOff) == 0)
-    StringOffsetMap.insert(std::make_pair(StrOff, CHStr));
+  StringOffsetMap.try_emplace(StrOff, CHStr);
   return StrOff;
 }
 


        


More information about the llvm-commits mailing list