Skip to content

Commit df3bc54

Browse files
[flang] Avoid repeated hash lookups (NFC) (#124230)
1 parent 196f7c2 commit df3bc54

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,9 @@ class BoxprocTypeRewriter : public mlir::TypeConverter {
6969
return false;
7070
}
7171
if (auto recTy = mlir::dyn_cast<RecordType>(ty)) {
72-
auto visited = visitedTypes.find(ty);
73-
if (visited != visitedTypes.end())
72+
auto [visited, inserted] = visitedTypes.try_emplace(ty, false);
73+
if (!inserted)
7474
return visited->second;
75-
[[maybe_unused]] auto newIt = visitedTypes.try_emplace(ty, false);
76-
assert(newIt.second && "expected ty to not be in the map");
7775
bool wasAlreadyVisitingRecordType = needConversionIsVisitingRecordType;
7876
needConversionIsVisitingRecordType = true;
7977
bool result = false;

0 commit comments

Comments
 (0)