[Mlir-commits] [mlir] [SPIRV] Avoid repeated hash lookups (NFC) (PR #111619)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 8 19:21:59 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-spirv
@llvm/pr-subscribers-mlir
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/111619.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp (+1-4)
``````````diff
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'
``````````
</details>
https://github.com/llvm/llvm-project/pull/111619
More information about the Mlir-commits
mailing list