[llvm] [GlobalISel] Avoid repeated hash lookups (NFC) (PR #110399)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 28 19:04:12 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-globalisel

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h (+2-8) 


``````````diff
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h b/llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h
index b749d9ef588ab3..0283fdded7f434 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h
@@ -318,11 +318,8 @@ class LegacyLegalizerInfo {
                         const unsigned AddressSpace,
                         const SizeAndActionsVec &SizeAndActions) {
     const unsigned OpcodeIdx = Opcode - FirstOp;
-    if (AddrSpace2PointerActions[OpcodeIdx].find(AddressSpace) ==
-        AddrSpace2PointerActions[OpcodeIdx].end())
-      AddrSpace2PointerActions[OpcodeIdx][AddressSpace] = {{}};
     SmallVector<SizeAndActionsVec, 1> &Actions =
-        AddrSpace2PointerActions[OpcodeIdx].find(AddressSpace)->second;
+        AddrSpace2PointerActions[OpcodeIdx][AddressSpace];
     setActions(TypeIndex, Actions, SizeAndActions);
   }
 
@@ -347,11 +344,8 @@ class LegacyLegalizerInfo {
                                  const unsigned ElementSize,
                                  const SizeAndActionsVec &SizeAndActions) {
     const unsigned OpcodeIdx = Opcode - FirstOp;
-    if (NumElements2Actions[OpcodeIdx].find(ElementSize) ==
-        NumElements2Actions[OpcodeIdx].end())
-      NumElements2Actions[OpcodeIdx][ElementSize] = {{}};
     SmallVector<SizeAndActionsVec, 1> &Actions =
-        NumElements2Actions[OpcodeIdx].find(ElementSize)->second;
+        NumElements2Actions[OpcodeIdx][ElementSize];
     setActions(TypeIndex, Actions, SizeAndActions);
   }
 

``````````

</details>


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


More information about the llvm-commits mailing list