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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 15 20:50:04 PST 2025


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

None

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

---
 llvm/utils/TableGen/AsmMatcherEmitter.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index fcc82e598c437..24822c847046d 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -2333,9 +2333,9 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName,
     OS << "  // " << InstructionConversionKinds[Row] << "\n";
     OS << "  { ";
     for (unsigned i = 0, e = ConversionTable[Row].size(); i != e; i += 2) {
-      OS << OperandConversionKinds[ConversionTable[Row][i]] << ", ";
-      if (OperandConversionKinds[ConversionTable[Row][i]] !=
-          CachedHashString("CVT_Tied")) {
+      const auto &OCK = OperandConversionKinds[ConversionTable[Row][i]];
+      OS << OCK << ", ";
+      if (OCK != CachedHashString("CVT_Tied")) {
         OS << (unsigned)(ConversionTable[Row][i + 1]) << ", ";
         continue;
       }



More information about the llvm-commits mailing list