[llvm] [GlobalISel] Avoid repeated hash lookups (NFC) (PR #110399)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 28 19:03:40 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/110399
None
>From 19fe79cbec6bb2984cb5be91aa10564ed96bc0db Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 28 Sep 2024 13:15:37 -0700
Subject: [PATCH] [GlobalISel] Avoid repeated hash lookups (NFC)
---
.../llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
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