From 951e57054fe7851ef5c3e66762a3cda5c10f9f69 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 24 May 2025 08:38:52 -0700 Subject: [PATCH] [Support] Use std::map::try_emplace (NFC) try_emplace can default-construct values, so we do not need to do so on our own. --- llvm/lib/Support/DAGDeltaAlgorithm.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Support/DAGDeltaAlgorithm.cpp b/llvm/lib/Support/DAGDeltaAlgorithm.cpp index 48302b8cb0621..981536473d124 100644 --- a/llvm/lib/Support/DAGDeltaAlgorithm.cpp +++ b/llvm/lib/Support/DAGDeltaAlgorithm.cpp @@ -179,8 +179,8 @@ DAGDeltaAlgorithmImpl::DAGDeltaAlgorithmImpl( const std::vector &Dependencies) : DDA(DDA) { for (change_ty Change : Changes) { - Predecessors.insert(std::make_pair(Change, std::vector())); - Successors.insert(std::make_pair(Change, std::vector())); + Predecessors.try_emplace(Change); + Successors.try_emplace(Change); } for (const edge_ty &Dep : Dependencies) { Predecessors[Dep.second].push_back(Dep.first); @@ -210,7 +210,7 @@ DAGDeltaAlgorithmImpl::DAGDeltaAlgorithmImpl( // Invert to form the predecessor closure map. for (change_ty Change : Changes) - PredClosure.insert(std::make_pair(Change, std::set())); + PredClosure.try_emplace(Change); for (change_ty Change : Changes) for (succ_closure_iterator_ty it2 = succ_closure_begin(Change), ie2 = succ_closure_end(Change);