diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp index a308d7f3e09e0..550d8b64dca35 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp @@ -491,15 +491,16 @@ static Value *getAddrSizeInt(Module *M, uint64_t C) { Function * WebAssemblyLowerEmscriptenEHSjLj::getFindMatchingCatch(Module &M, unsigned NumClauses) { - if (FindMatchingCatches.count(NumClauses)) - return FindMatchingCatches[NumClauses]; + auto [It, Inserted] = FindMatchingCatches.try_emplace(NumClauses); + if (!Inserted) + return It->second; PointerType *Int8PtrTy = PointerType::getUnqual(M.getContext()); SmallVector Args(NumClauses, Int8PtrTy); FunctionType *FTy = FunctionType::get(Int8PtrTy, Args, false); Function *F = getFunction( FTy, "__cxa_find_matching_catch_" + Twine(NumClauses + 2), &M); markAsImported(F); - FindMatchingCatches[NumClauses] = F; + It->second = F; return F; }