From b3b8a097fe1d6eba4d8a125e90b04273e95e96eb Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 9 Jun 2025 07:18:26 -0700 Subject: [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. --- mlir/lib/Bytecode/Writer/IRNumbering.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mlir/lib/Bytecode') 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; -- cgit v1.2.3