Author: Kazu Hirata Date: 2024-09-03T20:02:29-07:00 New Revision: f15e3e58c59b4d31eee24fa9debc5dfad0c20028
URL: https://github.com/llvm/llvm-project/commit/f15e3e58c59b4d31eee24fa9debc5dfad0c20028 DIFF: https://github.com/llvm/llvm-project/commit/f15e3e58c59b4d31eee24fa9debc5dfad0c20028.diff LOG: [CGOpenMPRuntime] Use DenseMap::operator[] (NFC) (#107158) I'm planning to deprecate DenseMap::FindAndConstruct in favor of DenseMap::operator[]. Added: Modified: clang/lib/CodeGen/CGOpenMPRuntime.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 34120486996fb1..23b977be816025 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1149,10 +1149,8 @@ void CGOpenMPRuntime::emitUserDefinedReduction( /*IsCombiner=*/false); } UDRMap.try_emplace(D, Combiner, Initializer); - if (CGF) { - auto &Decls = FunctionUDRMap.FindAndConstruct(CGF->CurFn); - Decls.second.push_back(D); - } + if (CGF) + FunctionUDRMap[CGF->CurFn].push_back(D); } std::pair<llvm::Function *, llvm::Function *> @@ -1432,10 +1430,8 @@ llvm::Value *CGOpenMPRuntime::getThreadID(CodeGenFunction &CGF, ThreadID = CGF.EmitLoadOfScalar(LVal, Loc); // If value loaded in entry block, cache it and use it everywhere in // function. - if (CGF.Builder.GetInsertBlock() == TopBlock) { - auto &Elem = OpenMPLocThreadIDMap.FindAndConstruct(CGF.CurFn); - Elem.second.ThreadID = ThreadID; - } + if (CGF.Builder.GetInsertBlock() == TopBlock) + OpenMPLocThreadIDMap[CGF.CurFn].ThreadID = ThreadID; return ThreadID; } } @@ -8640,8 +8636,7 @@ class MappableExprsHandler { const MapData &BaseData = CI == CE ? L : L1; OMPClauseMappableExprCommon::MappableExprComponentListRef SubData = SI == SE ? Components : Components1; - auto &OverlappedElements = OverlappedData.FindAndConstruct(&BaseData); - OverlappedElements.getSecond().push_back(SubData); + OverlappedData[&BaseData].push_back(SubData); } } } @@ -9316,10 +9311,8 @@ void CGOpenMPRuntime::emitUserDefinedMapper(const OMPDeclareMapperDecl *D, MapperCGF.EmitBlock(DoneBB, /*IsFinished=*/true); MapperCGF.FinishFunction(); UDMMap.try_emplace(D, Fn); - if (CGF) { - auto &Decls = FunctionUDMMap.FindAndConstruct(CGF->CurFn); - Decls.second.push_back(D); - } + if (CGF) + FunctionUDMMap[CGF->CurFn].push_back(D); } /// Emit the array initialization or deletion portion for user-defined mapper _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits