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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-spir-v

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/109243.diff


1 Files Affected:

- (modified) llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h (+1-5) 


``````````diff
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

``````````

</details>


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


More information about the llvm-commits mailing list