[llvm] [TableGen] Avoid repeated hash lookups (NFC) (PR #126190)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 6 22:53:18 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/126190

None

>From 6a68177c1a4691e7ba9a07af7657fbc97c16b4bc Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 6 Feb 2025 16:14:15 -0800
Subject: [PATCH] [TableGen] Avoid repeated hash lookups (NFC)

---
 llvm/utils/TableGen/AsmWriterEmitter.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp
index e7606b9df4626b1..795185c677e3020 100644
--- a/llvm/utils/TableGen/AsmWriterEmitter.cpp
+++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp
@@ -967,12 +967,11 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
             IAP.addOperand(ROName, MIOpNum, PrintMethodIdx);
 
             // There might be an additional predicate on the MCOperand
-            unsigned Entry = MCOpPredicateMap[Rec];
+            unsigned &Entry = MCOpPredicateMap[Rec];
             if (!Entry) {
               if (!Rec->isValueUnset("MCOperandPredicate")) {
                 MCOpPredicates.push_back(Rec);
                 Entry = MCOpPredicates.size();
-                MCOpPredicateMap[Rec] = Entry;
               } else
                 break; // No conditions on this operand at all
             }



More information about the llvm-commits mailing list