Skip to content

Commit 31e8c53

Browse files
[Affine] Avoid repeated hash lookups (NFC) (#111330)
1 parent 4bc0916 commit 31e8c53

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mlir/lib/Dialect/Affine/Analysis/Utils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,9 +1927,9 @@ static std::optional<int64_t> getMemoryFootprintBytes(Block &block,
19271927
return opInst->emitError("error obtaining memory region\n");
19281928
}
19291929

1930-
auto it = regions.find(region->memref);
1931-
if (it == regions.end()) {
1932-
regions[region->memref] = std::move(region);
1930+
auto [it, inserted] = regions.try_emplace(region->memref);
1931+
if (inserted) {
1932+
it->second = std::move(region);
19331933
} else if (failed(it->second->unionBoundingBox(*region))) {
19341934
return opInst->emitWarning(
19351935
"getMemoryFootprintBytes: unable to perform a union on a memory "

0 commit comments

Comments
 (0)