[Mlir-commits] [mlir] 0ee5c86 - [mlir][spirv] Avoid repeated hash lookups (NFC) (#111619)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 8 20:38:22 PDT 2024
Author: Kazu Hirata
Date: 2024-10-08T20:38:19-07:00
New Revision: 0ee5c869fc003b09e464e079d6bbaab1baf59aba
URL: https://github.com/llvm/llvm-project/commit/0ee5c869fc003b09e464e079d6bbaab1baf59aba
DIFF: https://github.com/llvm/llvm-project/commit/0ee5c869fc003b09e464e079d6bbaab1baf59aba.diff
LOG: [mlir][spirv] Avoid repeated hash lookups (NFC) (#111619)
Added:
Modified:
mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
index c8386fecea038a..dd0a872e05dcbb 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
@@ -1538,11 +1538,8 @@ LogicalResult spirv::ModuleOp::verifyRegions() {
auto key = std::pair<spirv::FuncOp, spirv::ExecutionModel>(
funcOp, entryPointOp.getExecutionModel());
- auto entryPtIt = entryPoints.find(key);
- if (entryPtIt != entryPoints.end()) {
+ if (!entryPoints.try_emplace(key, entryPointOp).second)
return entryPointOp.emitError("duplicate of a previous EntryPointOp");
- }
- entryPoints[key] = entryPointOp;
} else if (auto funcOp = dyn_cast<spirv::FuncOp>(op)) {
// If the function is external and does not have 'Import'
// linkage_attributes(LinkageAttributes), throw an error. 'Import'
More information about the Mlir-commits
mailing list