[llvm] [MCParser] Avoid repeated hash lookups (NFC) (PR #110204)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 27 17:17:22 PDT 2024
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/110204
>From 701a0e69b19617312f3e8168485f1979c28b0b63 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 26 Sep 2024 08:14:23 -0700
Subject: [PATCH] [MCParser] Avoid repeated hash lookups (NFC)
---
llvm/lib/MC/MCParser/MasmParser.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
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