[llvm] 8c1207b - [SPIRV] Avoid repeated map lookups (NFC) (#128129)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 21 11:08:33 PST 2025


Author: Kazu Hirata
Date: 2025-02-21T11:08:30-08:00
New Revision: 8c1207bee3c65baab784574a0440f154d325b6c6

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

LOG: [SPIRV] Avoid repeated map lookups (NFC) (#128129)

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
index e6b8a381b7180..c7f846b8e9bcc 100644
--- a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
+++ b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
@@ -176,8 +176,9 @@ struct ModuleAnalysisInfo {
     RegisterAliasTable[MF][Reg] = AliasReg;
   }
   Register getRegisterAlias(const MachineFunction *MF, Register Reg) {
-    auto RI = RegisterAliasTable[MF].find(Reg);
-    if (RI == RegisterAliasTable[MF].end()) {
+    auto &RegTable = RegisterAliasTable[MF];
+    auto RI = RegTable.find(Reg);
+    if (RI == RegTable.end()) {
       return Register(0);
     }
     return RI->second;


        


More information about the llvm-commits mailing list