From ffebc27365e692e62552cb87bd98f884dc8870ee Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 20 Feb 2025 09:32:50 -0800 Subject: [PATCH] [SPIRV] Avoid repeated map lookups (NFC) --- llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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;