[llvm] 5bc673d - [MCParser] Avoid repeated hash lookups (NFC) (#110204)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 28 10:05:21 PDT 2024


Author: Kazu Hirata
Date: 2024-09-28T10:05:18-07:00
New Revision: 5bc673d37106666a545de28dfb80addf460f3de9

URL: https://github.com/llvm/llvm-project/commit/5bc673d37106666a545de28dfb80addf460f3de9
DIFF: https://github.com/llvm/llvm-project/commit/5bc673d37106666a545de28dfb80addf460f3de9.diff

LOG: [MCParser] Avoid repeated hash lookups (NFC) (#110204)

Added: 
    

Modified: 
    llvm/lib/MC/MCParser/MasmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index c5ff1e7acbfd2a..d88fd09a1aa07c 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -479,9 +479,7 @@ class MasmParser : public MCAsmParser {
   void addDirectiveHandler(StringRef Directive,
                            ExtensionDirectiveHandler Handler) override {
     ExtensionDirectiveMap[Directive] = Handler;
-    if (!DirectiveKindMap.contains(Directive)) {
-      DirectiveKindMap[Directive] = DK_HANDLER_DIRECTIVE;
-    }
+    DirectiveKindMap.try_emplace(Directive, DK_HANDLER_DIRECTIVE);
   }
 
   void addAliasForDirective(StringRef Directive, StringRef Alias) override {


        


More information about the llvm-commits mailing list