[llvm] [llvm-exegesis] Avoid repeated hash lookups (NFC) (PR #132331)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 20 20:56:34 PDT 2025


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

None

>From 81e4c203d927a52c6cd0f5c9064a3671fd8f969b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 20 Mar 2025 09:42:59 -0700
Subject: [PATCH] [llvm-exegesis] Avoid repeated hash lookups (NFC)

---
 llvm/tools/llvm-exegesis/lib/Assembler.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/llvm/tools/llvm-exegesis/lib/Assembler.cpp b/llvm/tools/llvm-exegesis/lib/Assembler.cpp
index b6104d10af3ca..f638478e0c51d 100644
--- a/llvm/tools/llvm-exegesis/lib/Assembler.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Assembler.cpp
@@ -65,11 +65,12 @@ static bool generateSnippetSetupCode(const ExegesisTarget &ET,
       assert(MM.Address % getpagesize() == 0 &&
              "Memory mappings need to be aligned to page boundaries.");
 #endif
+      const MemoryValue &MemVal = Key.MemoryValues.at(MM.MemoryValueName);
       BBF.addInstructions(ET.generateMmap(
-          MM.Address, Key.MemoryValues.at(MM.MemoryValueName).SizeBytes,
+          MM.Address, MemVal.SizeBytes,
           ET.getAuxiliaryMemoryStartAddress() +
-              sizeof(int) * (Key.MemoryValues.at(MM.MemoryValueName).Index +
-                             SubprocessMemory::AuxiliaryMemoryOffset)));
+              sizeof(int) *
+                  (MemVal.Index + SubprocessMemory::AuxiliaryMemoryOffset)));
     }
     BBF.addInstructions(ET.setStackRegisterToAuxMem());
   }



More information about the llvm-commits mailing list