[llvm] [MCParser] Avoid repeated hash lookups (NFC) (PR #110204)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 19:56:15 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mc
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/110204.diff
1 Files Affected:
- (modified) llvm/lib/MC/MCParser/MasmParser.cpp (+1-3)
``````````diff
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 {
``````````
</details>
https://github.com/llvm/llvm-project/pull/110204
More information about the llvm-commits
mailing list