[llvm] 94e9813 - [AsmParser] Avoid repeated map lookups (NFC) (#123015)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 07:56:48 PST 2025


Author: Kazu Hirata
Date: 2025-01-15T07:56:45-08:00
New Revision: 94e9813a20ed5885ae2908f8519f93d8082fd1f3

URL: https://github.com/llvm/llvm-project/commit/94e9813a20ed5885ae2908f8519f93d8082fd1f3
DIFF: https://github.com/llvm/llvm-project/commit/94e9813a20ed5885ae2908f8519f93d8082fd1f3.diff

LOG: [AsmParser] Avoid repeated map lookups (NFC) (#123015)

Added: 
    

Modified: 
    llvm/lib/AsmParser/LLParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 81d048b32e139b..be6166f0c41694 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -941,8 +941,8 @@ bool LLParser::parseMDNodeID(MDNode *&Result) {
     return true;
 
   // If not a forward reference, just return it now.
-  if (NumberedMetadata.count(MID)) {
-    Result = NumberedMetadata[MID];
+  if (auto It = NumberedMetadata.find(MID); It != NumberedMetadata.end()) {
+    Result = It->second;
     return false;
   }
 


        


More information about the llvm-commits mailing list