[llvm] 30089b1 - [DWARF] Avoid repeated hash lookups (NFC) (#110202)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 28 10:04:06 PDT 2024


Author: Kazu Hirata
Date: 2024-09-28T10:04:03-07:00
New Revision: 30089b159090ec75f657928f7cdb8aafea07159d

URL: https://github.com/llvm/llvm-project/commit/30089b159090ec75f657928f7cdb8aafea07159d
DIFF: https://github.com/llvm/llvm-project/commit/30089b159090ec75f657928f7cdb8aafea07159d.diff

LOG: [DWARF] Avoid repeated hash lookups (NFC) (#110202)

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index eb2751ab30ac50..fa3e8ad21dbd4d 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -1014,10 +1014,8 @@ void DWARFVerifier::verifyDebugLineRows() {
           DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, FullPath);
       assert(HasFullPath && "Invalid index?");
       (void)HasFullPath;
-      auto It = FullPathMap.find(FullPath);
-      if (It == FullPathMap.end())
-        FullPathMap[FullPath] = FileIndex;
-      else if (It->second != FileIndex && DumpOpts.Verbose) {
+      auto [It, Inserted] = FullPathMap.try_emplace(FullPath, FileIndex);
+      if (!Inserted && It->second != FileIndex && DumpOpts.Verbose) {
         warn() << ".debug_line["
                << format("0x%08" PRIx64,
                          *toSectionOffset(Die.find(DW_AT_stmt_list)))


        


More information about the llvm-commits mailing list