[llvm] fc467b4 - [AMDGPU] Avoid repeated hash lookups (NFC) (#111787)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 08:18:31 PDT 2024
Author: Kazu Hirata
Date: 2024-10-10T08:18:28-07:00
New Revision: fc467b477545c9f8ef4dc36ecee4dcd2a7457787
URL: https://github.com/llvm/llvm-project/commit/fc467b477545c9f8ef4dc36ecee4dcd2a7457787
DIFF: https://github.com/llvm/llvm-project/commit/fc467b477545c9f8ef4dc36ecee4dcd2a7457787.diff
LOG: [AMDGPU] Avoid repeated hash lookups (NFC) (#111787)
Added:
Modified:
llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp b/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
index 7e4d9d21a0b397..1b88fdd3ab2e1c 100644
--- a/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
@@ -1647,16 +1647,18 @@ SDValue R600TargetLowering::OptimizeSwizzle(SDValue BuildVector, SDValue Swz[],
BuildVector = CompactSwizzlableVector(DAG, BuildVector, SwizzleRemap);
for (unsigned i = 0; i < 4; i++) {
unsigned Idx = Swz[i]->getAsZExtVal();
- if (SwizzleRemap.contains(Idx))
- Swz[i] = DAG.getConstant(SwizzleRemap[Idx], DL, MVT::i32);
+ auto It = SwizzleRemap.find(Idx);
+ if (It != SwizzleRemap.end())
+ Swz[i] = DAG.getConstant(It->second, DL, MVT::i32);
}
SwizzleRemap.clear();
BuildVector = ReorganizeVector(DAG, BuildVector, SwizzleRemap);
for (unsigned i = 0; i < 4; i++) {
unsigned Idx = Swz[i]->getAsZExtVal();
- if (SwizzleRemap.contains(Idx))
- Swz[i] = DAG.getConstant(SwizzleRemap[Idx], DL, MVT::i32);
+ auto It = SwizzleRemap.find(Idx);
+ if (It != SwizzleRemap.end())
+ Swz[i] = DAG.getConstant(It->second, DL, MVT::i32);
}
return BuildVector;
More information about the llvm-commits
mailing list