Skip to content

Commit c5ea7b8

Browse files
[mlir] Avoid repeated hash lookups (NFC) (llvm#113249)
1 parent 5dbfb49 commit c5ea7b8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

mlir/lib/Pass/IRPrinting.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,8 @@ getOpAndSymbolNames(Operation *op, StringRef passName,
216216
SmallVector<std::pair<std::string, StringRef>> pathElements;
217217
SmallVector<unsigned> countPrefix;
218218

219-
if (!counters.contains(op))
220-
counters[op] = -1;
221-
222219
Operation *iter = op;
223-
++counters[op];
220+
++counters.try_emplace(op, -1).first->second;
224221
while (iter) {
225222
countPrefix.push_back(counters[iter]);
226223
StringAttr symbolName =

0 commit comments

Comments
 (0)