[llvm] 19e5a52 - [GlobalISel] Avoid repeated hash lookups (NFC) (#110399)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 29 08:54:45 PDT 2024


Author: Kazu Hirata
Date: 2024-09-29T08:54:42-07:00
New Revision: 19e5a529e8071aa9820291c6c12e99ba2cbc70dc

URL: https://github.com/llvm/llvm-project/commit/19e5a529e8071aa9820291c6c12e99ba2cbc70dc
DIFF: https://github.com/llvm/llvm-project/commit/19e5a529e8071aa9820291c6c12e99ba2cbc70dc.diff

LOG: [GlobalISel] Avoid repeated hash lookups (NFC) (#110399)

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h

Removed: 
    


################################################################################
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);
   }
 


        


More information about the llvm-commits mailing list