From 3f709e42e3be0f28a88ca3e77663a02b52c914f4 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 6 Dec 2025 20:56:45 +0100 Subject: Vendor import of llvm-project main llvmorg-21-init-19288-gface93e724f4, the last commit before the upstream release/21.x branch was created. --- llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp') diff --git a/llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp b/llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp index cd84e68aed14..0469fbf15b25 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp @@ -28,17 +28,17 @@ const SortRegion *SortRegionInfo::getRegionFor(const MachineBasicBlock *MBB) { // WE->contains(ML->getHeader()), but not ML->contains(WE->getHeader()). if ((ML && !WE) || (ML && WE && WE->contains(ML->getHeader()))) { // If the smallest region containing MBB is a loop - if (LoopMap.count(ML)) - return LoopMap[ML].get(); - LoopMap[ML] = std::make_unique>(ML); - return LoopMap[ML].get(); + auto [It, Inserted] = LoopMap.try_emplace(ML); + if (Inserted) + It->second = std::make_unique>(ML); + return It->second.get(); } else { // If the smallest region containing MBB is an exception - if (ExceptionMap.count(WE)) - return ExceptionMap[WE].get(); - ExceptionMap[WE] = - std::make_unique>(WE); - return ExceptionMap[WE].get(); + auto [It, Inserted] = ExceptionMap.try_emplace(WE); + if (Inserted) + It->second = + std::make_unique>(WE); + return It->second.get(); } } -- cgit v1.3