Skip to content

Commit 0ee5c86

Browse files
[mlir][spirv] Avoid repeated hash lookups (NFC) (#111619)
1 parent 2d8cd32 commit 0ee5c86

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,11 +1538,8 @@ LogicalResult spirv::ModuleOp::verifyRegions() {
15381538

15391539
auto key = std::pair<spirv::FuncOp, spirv::ExecutionModel>(
15401540
funcOp, entryPointOp.getExecutionModel());
1541-
auto entryPtIt = entryPoints.find(key);
1542-
if (entryPtIt != entryPoints.end()) {
1541+
if (!entryPoints.try_emplace(key, entryPointOp).second)
15431542
return entryPointOp.emitError("duplicate of a previous EntryPointOp");
1544-
}
1545-
entryPoints[key] = entryPointOp;
15461543
} else if (auto funcOp = dyn_cast<spirv::FuncOp>(op)) {
15471544
// If the function is external and does not have 'Import'
15481545
// linkage_attributes(LinkageAttributes), throw an error. 'Import'

0 commit comments

Comments
 (0)