[llvm] b9f9b3b - [SPIRV][NFC] Use DenseMap's lookup instead of find (#164237)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 20 07:18:50 PDT 2025
Author: Juan Manuel Martinez CaamaƱo
Date: 2025-10-20T16:18:46+02:00
New Revision: b9f9b3b7eb3cc5e93fabcf68068bce5cedc21639
URL: https://github.com/llvm/llvm-project/commit/b9f9b3b7eb3cc5e93fabcf68068bce5cedc21639
DIFF: https://github.com/llvm/llvm-project/commit/b9f9b3b7eb3cc5e93fabcf68068bce5cedc21639.diff
LOG: [SPIRV][NFC] Use DenseMap's lookup instead of find (#164237)
[lookup](https://llvm.org/doxygen/classllvm_1_1DenseMapBase.html#a0b2ca98dc28c61793ff5c90d23e5f14e)
does a find and returns the default if no matching element was found.
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 d8376cd1aeb5a..2d19f6de604e4 100644
--- a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
+++ b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
@@ -169,9 +169,7 @@ struct ModuleAnalysisInfo {
MCRegister getFuncReg(const Function *F) {
assert(F && "Function is null");
- auto FuncPtrRegPair = FuncMap.find(F);
- return FuncPtrRegPair == FuncMap.end() ? MCRegister()
- : FuncPtrRegPair->second;
+ return FuncMap.lookup(F);
}
MCRegister getExtInstSetReg(unsigned SetNum) { return ExtInstSetMap[SetNum]; }
InstrList &getMSInstrs(unsigned MSType) { return MS[MSType]; }
More information about the llvm-commits
mailing list