[llvm] [SPIRV] Avoid repeated hash lookups (NFC) (PR #109243)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 23:20:22 PDT 2024


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

None

>From b9a0bd1a305ed707a7401d8bcf4f7a129232f0fd Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 17 Sep 2024 00:33:05 -0700
Subject: [PATCH] [SPIRV] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h
index a5cb86f4f1c638..ed9cfc07132430 100644
--- a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h
+++ b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h
@@ -255,11 +255,7 @@ class SPIRVGlobalRegistry {
 
   // Add a record about forward function call.
   void addForwardCall(const Function *F, MachineInstr *MI) {
-    auto It = ForwardCalls.find(F);
-    if (It == ForwardCalls.end())
-      ForwardCalls[F] = {MI};
-    else
-      It->second.insert(MI);
+    ForwardCalls[F].insert(MI);
   }
 
   // Map a Function to the vector of machine instructions that represents



More information about the llvm-commits mailing list