[llvm] 8d75246 - [AMDGPU] Avoid repeated hash lookups (NFC) (#127371)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 16 08:15:10 PST 2025


Author: Kazu Hirata
Date: 2025-02-16T08:15:08-08:00
New Revision: 8d752467e0e023f9b2dc83ca1829f75024f0440d

URL: https://github.com/llvm/llvm-project/commit/8d752467e0e023f9b2dc83ca1829f75024f0440d
DIFF: https://github.com/llvm/llvm-project/commit/8d752467e0e023f9b2dc83ca1829f75024f0440d.diff

LOG: [AMDGPU] Avoid repeated hash lookups (NFC) (#127371)

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
index 17207773b4858..c0581e491720d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
@@ -948,12 +948,13 @@ Constant *AMDGPUSwLowerLDS::getAddressesOfVariablesInKernel(
 
   SmallVector<Constant *> Elements;
   for (auto *GV : Variables) {
-    if (!LDSParams.LDSToReplacementIndicesMap.contains(GV)) {
+    auto It = LDSParams.LDSToReplacementIndicesMap.find(GV);
+    if (It == LDSParams.LDSToReplacementIndicesMap.end()) {
       Elements.push_back(
           PoisonValue::get(IRB.getPtrTy(AMDGPUAS::GLOBAL_ADDRESS)));
       continue;
     }
-    auto &Indices = LDSParams.LDSToReplacementIndicesMap[GV];
+    auto &Indices = It->second;
     Constant *GEPIdx[] = {ConstantInt::get(Int32Ty, Indices[0]),
                           ConstantInt::get(Int32Ty, Indices[1]),
                           ConstantInt::get(Int32Ty, Indices[2])};


        


More information about the llvm-commits mailing list