diff options
| author | Kazu Hirata <kazu@google.com> | 2025-06-09 07:18:26 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-09 07:18:26 -0700 |
| commit | b3b8a097fe1d6eba4d8a125e90b04273e95e96eb (patch) | |
| tree | 0d12acb7af2b2fb5b3937396f3d2a7066a24b12a /mlir/lib/Bytecode | |
| parent | 939666380fba5d6db3d224fc358fd3e0f40a9b53 (diff) | |
[mlir] Use *Map::try_emplace (NFC) (#143341)
- try_emplace(Key) is shorter than insert({Key, nullptr}).
- try_emplace performs value initialization without value parameters.
- We overwrite values on successful insertion anyway.
Diffstat (limited to 'mlir/lib/Bytecode')
| -rw-r--r-- | mlir/lib/Bytecode/Writer/IRNumbering.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/lib/Bytecode/Writer/IRNumbering.cpp b/mlir/lib/Bytecode/Writer/IRNumbering.cpp index 1bc02e172157..8e8e7148ee70 100644 --- a/mlir/lib/Bytecode/Writer/IRNumbering.cpp +++ b/mlir/lib/Bytecode/Writer/IRNumbering.cpp @@ -308,7 +308,7 @@ void IRNumberingState::computeGlobalNumberingState(Operation *rootOp) { } void IRNumberingState::number(Attribute attr) { - auto it = attrs.insert({attr, nullptr}); + auto it = attrs.try_emplace(attr); if (!it.second) { ++it.first->second->refCount; return; @@ -475,7 +475,7 @@ void IRNumberingState::number(OperationName opName) { } void IRNumberingState::number(Type type) { - auto it = types.insert({type, nullptr}); + auto it = types.try_emplace(type); if (!it.second) { ++it.first->second->refCount; return; |
