[llvm] ae30383 - [SPIR-V] Avoid repeated map lookups. NFC (#125036)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 00:15:05 PST 2025
Author: Craig Topper
Date: 2025-01-30T00:15:02-08:00
New Revision: ae3038379fa7f9a26179652ddd01122b4b49c917
URL: https://github.com/llvm/llvm-project/commit/ae3038379fa7f9a26179652ddd01122b4b49c917
DIFF: https://github.com/llvm/llvm-project/commit/ae3038379fa7f9a26179652ddd01122b4b49c917.diff
LOG: [SPIR-V] Avoid repeated map lookups. NFC (#125036)
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 79b5444cca205d..e6b8a381b71800 100644
--- a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
+++ b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
@@ -180,11 +180,13 @@ struct ModuleAnalysisInfo {
if (RI == RegisterAliasTable[MF].end()) {
return Register(0);
}
- return RegisterAliasTable[MF][Reg];
+ return RI->second;
}
bool hasRegisterAlias(const MachineFunction *MF, Register Reg) {
- return RegisterAliasTable.find(MF) != RegisterAliasTable.end() &&
- RegisterAliasTable[MF].find(Reg) != RegisterAliasTable[MF].end();
+ auto RI = RegisterAliasTable.find(MF);
+ if (RI == RegisterAliasTable.end())
+ return false;
+ return RI->second.find(Reg) != RI->second.end();
}
unsigned getNextID() { return MaxID++; }
bool hasMBBRegister(const MachineBasicBlock &MBB) {
More information about the llvm-commits
mailing list