From fb5b5046b3b35c4cd349a239232291082b13f372 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Fri, 13 Apr 2018 17:48:43 +0000 Subject: [PATCH] [OPENMP] Replace push_back by emplace_back, NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330042 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGOpenMPRuntime.cpp | 18 +++++++++--------- lib/CodeGen/CGStmtOpenMP.cpp | 4 ++-- lib/Sema/SemaOpenMP.cpp | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp index 547876bf01..004008b693 100644 --- a/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1285,7 +1285,7 @@ void CGOpenMPRuntime::emitUserDefinedReduction( cast(D->lookup(Priv).front()), /*IsCombiner=*/false); } - UDRMap.insert(std::make_pair(D, std::make_pair(Combiner, Initializer))); + UDRMap.try_emplace(D, Combiner, Initializer); if (CGF) { auto &Decls = FunctionUDRMap.FindAndConstruct(CGF->CurFn); Decls.second.push_back(D); @@ -2817,7 +2817,7 @@ CGOpenMPRuntime::getOrCreateInternalVariable(llvm::Type *Ty, llvm::raw_svector_ostream Out(Buffer); Out << Name; auto RuntimeName = Out.str(); - auto &Elem = *InternalVars.insert(std::make_pair(RuntimeName, nullptr)).first; + auto &Elem = *InternalVars.try_emplace(RuntimeName, nullptr).first; if (Elem.second) { assert(Elem.second->getType()->getPointerElementType() == Ty && "OMP internal variable has different type than requested"); @@ -4659,31 +4659,31 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc, auto I = Data.PrivateCopies.begin(); for (auto *E : Data.PrivateVars) { auto *VD = cast(cast(E)->getDecl()); - Privates.push_back(std::make_pair( + Privates.emplace_back( C.getDeclAlign(VD), PrivateHelpersTy(VD, cast(cast(*I)->getDecl()), - /*PrivateElemInit=*/nullptr))); + /*PrivateElemInit=*/nullptr)); ++I; } I = Data.FirstprivateCopies.begin(); auto IElemInitRef = Data.FirstprivateInits.begin(); for (auto *E : Data.FirstprivateVars) { auto *VD = cast(cast(E)->getDecl()); - Privates.push_back(std::make_pair( + Privates.emplace_back( C.getDeclAlign(VD), PrivateHelpersTy( VD, cast(cast(*I)->getDecl()), - cast(cast(*IElemInitRef)->getDecl())))); + cast(cast(*IElemInitRef)->getDecl()))); ++I; ++IElemInitRef; } I = Data.LastprivateCopies.begin(); for (auto *E : Data.LastprivateVars) { auto *VD = cast(cast(E)->getDecl()); - Privates.push_back(std::make_pair( + Privates.emplace_back( C.getDeclAlign(VD), PrivateHelpersTy(VD, cast(cast(*I)->getDecl()), - /*PrivateElemInit=*/nullptr))); + /*PrivateElemInit=*/nullptr)); ++I; } std::stable_sort(Privates.begin(), Privates.end(), stable_sort_comparator); @@ -7240,7 +7240,7 @@ emitOffloadingArrays(CodeGenFunction &CGF, if (Info.requiresDevicePointerInfo()) if (auto *DevVD = BasePointers[i].getDevicePtrDecl()) - Info.CaptureDeviceAddrMap.insert(std::make_pair(DevVD, BPAddr)); + Info.CaptureDeviceAddrMap.try_emplace(DevVD, BPAddr); llvm::Value *PVal = Pointers[i]; llvm::Value *P = CGF.Builder.CreateConstInBoundsGEP2_32( diff --git a/lib/CodeGen/CGStmtOpenMP.cpp b/lib/CodeGen/CGStmtOpenMP.cpp index f822d07c0c..c207fb64a3 100644 --- a/lib/CodeGen/CGStmtOpenMP.cpp +++ b/lib/CodeGen/CGStmtOpenMP.cpp @@ -2832,7 +2832,7 @@ void CodeGenFunction::EmitOMPTaskBasedDirective( // Build list of dependences. for (const auto *C : S.getClausesOfKind()) for (const Expr *IRef : C->varlists()) - Data.Dependences.push_back(std::make_pair(C->getDependencyKind(), IRef)); + Data.Dependences.emplace_back(C->getDependencyKind(), IRef); auto &&CodeGen = [&Data, &S, CS, &BodyGen, &LastprivateDstsOrigs, CapturedRegion](CodeGenFunction &CGF, PrePostActionTy &Action) { @@ -3068,7 +3068,7 @@ void CodeGenFunction::EmitOMPTargetTaskBasedDirective( // Build list of dependences. for (const auto *C : S.getClausesOfKind()) for (const Expr *IRef : C->varlists()) - Data.Dependences.push_back(std::make_pair(C->getDependencyKind(), IRef)); + Data.Dependences.emplace_back(C->getDependencyKind(), IRef); auto &&CodeGen = [&Data, &S, CS, &BodyGen, BPVD, PVD, SVD, &InputInfo](CodeGenFunction &CGF, PrePostActionTy &Action) { // Set proper addresses for generated private copies. diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 26a55787c3..9bafff247d 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -224,7 +224,7 @@ public: } void addCriticalWithHint(OMPCriticalDirective *D, llvm::APSInt Hint) { - Criticals[D->getDirectiveName().getAsString()] = std::make_pair(D, Hint); + Criticals.try_emplace(D->getDirectiveName().getAsString(), D, Hint); } const std::pair getCriticalWithHint(const DeclarationNameInfo &Name) const { @@ -3405,7 +3405,7 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPDeclareSimdDirective( if (FD->getNumParams() > PVD->getFunctionScopeIndex() && FD->getParamDecl(PVD->getFunctionScopeIndex()) ->getCanonicalDecl() == PVD->getCanonicalDecl()) { - UniformedArgs.insert(std::make_pair(PVD->getCanonicalDecl(), E)); + UniformedArgs.try_emplace(PVD->getCanonicalDecl(), E); continue; } if (isa(E)) { -- 2.40.0