diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2025-12-06 19:56:45 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2025-12-06 20:08:43 +0000 |
| commit | 3f709e42e3be0f28a88ca3e77663a02b52c914f4 (patch) | |
| tree | 948796bf3bf7e164373caf6c31f9f128ca85fd8c /llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp | |
| parent | 32a711e1c447004eb1fd015925f305ed1d8426de (diff) | |
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
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<ConcreteSortRegion<MachineLoop>>(ML); - return LoopMap[ML].get(); + auto [It, Inserted] = LoopMap.try_emplace(ML); + if (Inserted) + It->second = std::make_unique<ConcreteSortRegion<MachineLoop>>(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<ConcreteSortRegion<WebAssemblyException>>(WE); - return ExceptionMap[WE].get(); + auto [It, Inserted] = ExceptionMap.try_emplace(WE); + if (Inserted) + It->second = + std::make_unique<ConcreteSortRegion<WebAssemblyException>>(WE); + return It->second.get(); } } |
