[Mlir-commits] [mlir] [SPIRV] Avoid repeated hash lookups (NFC) (PR #111619)
Kazu Hirata
llvmlistbot at llvm.org
Tue Oct 8 19:21:26 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/111619
None
>From 4fa54da4eeafdc052d4b1f0efa5561837aa61322 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 8 Oct 2024 07:35:41 -0700
Subject: [PATCH] [SPIRV] Avoid repeated hash lookups (NFC)
---
mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
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