[llvm] 791da3c - [AsmPrinter] Avoid repeated hash lookups (NFC) (#128630)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 09:02:04 PST 2025


Author: Kazu Hirata
Date: 2025-02-25T09:02:00-08:00
New Revision: 791da3c5c2efc13e952ec4fe041e88428e4a331a

URL: https://github.com/llvm/llvm-project/commit/791da3c5c2efc13e952ec4fe041e88428e4a331a
DIFF: https://github.com/llvm/llvm-project/commit/791da3c5c2efc13e952ec4fe041e88428e4a331a.diff

LOG: [AsmPrinter] Avoid repeated hash lookups (NFC) (#128630)

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index ddf0275ddfe6a..5bc30fede4720 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1777,8 +1777,9 @@ DIE *DwarfCompileUnit::getOrCreateContextDIE(const DIScope *Context) {
 
     // Otherwise the context must be a DISubprogram.
     auto *SPScope = cast<DISubprogram>(Context);
-    if (getAbstractScopeDIEs().count(SPScope))
-      return getAbstractScopeDIEs()[SPScope];
+    const auto &DIEs = getAbstractScopeDIEs();
+    if (auto It = DIEs.find(SPScope); It != DIEs.end())
+      return It->second;
   }
   return DwarfUnit::getOrCreateContextDIE(Context);
 }


        


More information about the llvm-commits mailing list