diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp | 205 |
1 files changed, 150 insertions, 55 deletions
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp index cfd5eda8cc80..5e8d98cfe5ef 100644 --- a/contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -21,6 +21,7 @@ #include "clang/AST/OpenMPClause.h" #include "clang/AST/Stmt.h" #include "clang/AST/StmtOpenMP.h" +#include "clang/AST/StmtVisitor.h" #include "clang/Basic/OpenMPKinds.h" #include "clang/Basic/PrettyStackTrace.h" #include "llvm/Frontend/OpenMP/OMPConstants.h" @@ -1562,6 +1563,17 @@ static void emitCommonOMPParallelDirective( CapturedVars, IfCond); } +static bool isAllocatableDecl(const VarDecl *VD) { + const VarDecl *CVD = VD->getCanonicalDecl(); + if (!CVD->hasAttr<OMPAllocateDeclAttr>()) + return false; + const auto *AA = CVD->getAttr<OMPAllocateDeclAttr>(); + // Use the default allocation. + return !((AA->getAllocatorType() == OMPAllocateDeclAttr::OMPDefaultMemAlloc || + AA->getAllocatorType() == OMPAllocateDeclAttr::OMPNullMemAlloc) && + !AA->getAllocator()); +} + static void emitEmptyBoundParameters(CodeGenFunction &, const OMPExecutableDirective &, llvm::SmallVectorImpl<llvm::Value *> &) {} @@ -1574,12 +1586,7 @@ Address CodeGenFunction::OMPBuilderCBHelpers::getAddressOfLocalVariable( if (!VD) return Address::invalid(); const VarDecl *CVD = VD->getCanonicalDecl(); - if (!CVD->hasAttr<OMPAllocateDeclAttr>()) - return Address::invalid(); - const auto *AA = CVD->getAttr<OMPAllocateDeclAttr>(); - // Use the default allocation. - if (AA->getAllocatorType() == OMPAllocateDeclAttr::OMPDefaultMemAlloc && - !AA->getAllocator()) + if (!isAllocatableDecl(CVD)) return Address::invalid(); llvm::Value *Size; CharUnits Align = CGM.getContext().getDeclAlign(CVD); @@ -1595,6 +1602,7 @@ Address CodeGenFunction::OMPBuilderCBHelpers::getAddressOfLocalVariable( Size = CGM.getSize(Sz.alignTo(Align)); } + const auto *AA = CVD->getAttr<OMPAllocateDeclAttr>(); assert(AA->getAllocator() && "Expected allocator expression for non-default allocator."); llvm::Value *Allocator = CGF.EmitScalarExpr(AA->getAllocator()); @@ -1606,11 +1614,11 @@ Address CodeGenFunction::OMPBuilderCBHelpers::getAddressOfLocalVariable( Allocator = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(Allocator, CGM.VoidPtrTy); - llvm::Value *Addr = OMPBuilder.CreateOMPAlloc( + llvm::Value *Addr = OMPBuilder.createOMPAlloc( CGF.Builder, Size, Allocator, getNameWithSeparators({CVD->getName(), ".void.addr"}, ".", ".")); llvm::CallInst *FreeCI = - OMPBuilder.CreateOMPFree(CGF.Builder, Addr, Allocator); + OMPBuilder.createOMPFree(CGF.Builder, Addr, Allocator); CGF.EHStack.pushCleanup<OMPAllocateCleanupTy>(NormalAndEHCleanup, FreeCI); Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast( @@ -1638,7 +1646,7 @@ Address CodeGenFunction::OMPBuilderCBHelpers::getAddrOfThreadPrivate( llvm::Twine CacheName = Twine(CGM.getMangledName(VD)).concat(Suffix); llvm::CallInst *ThreadPrivateCacheCall = - OMPBuilder.CreateCachedThreadPrivate(CGF.Builder, Data, Size, CacheName); + OMPBuilder.createCachedThreadPrivate(CGF.Builder, Data, Size, CacheName); return Address(ThreadPrivateCacheCall, VDAddr.getAlignment()); } @@ -1685,7 +1693,7 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) { // // TODO: This defaults to shared right now. auto PrivCB = [](InsertPointTy AllocaIP, InsertPointTy CodeGenIP, - llvm::Value &Val, llvm::Value *&ReplVal) { + llvm::Value &, llvm::Value &Val, llvm::Value *&ReplVal) { // The next line is appropriate only for variables (Val) with the // data-sharing attribute "shared". ReplVal = &Val; @@ -1707,9 +1715,11 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) { CGCapturedStmtInfo CGSI(*CS, CR_OpenMP); CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(*this, &CGSI); - Builder.restoreIP(OMPBuilder.CreateParallel(Builder, BodyGenCB, PrivCB, - FiniCB, IfCond, NumThreads, - ProcBind, S.hasCancel())); + llvm::OpenMPIRBuilder::InsertPointTy AllocaIP( + AllocaInsertPt->getParent(), AllocaInsertPt->getIterator()); + Builder.restoreIP( + OMPBuilder.createParallel(Builder, AllocaIP, BodyGenCB, PrivCB, FiniCB, + IfCond, NumThreads, ProcBind, S.hasCancel())); return; } @@ -2979,7 +2989,7 @@ bool CodeGenFunction::EmitOMPWorksharingLoop( ((ScheduleKind.Schedule == OMPC_SCHEDULE_static || ScheduleKind.Schedule == OMPC_SCHEDULE_unknown) && !(ScheduleKind.M1 == OMPC_SCHEDULE_MODIFIER_nonmonotonic || - ScheduleKind.M1 == OMPC_SCHEDULE_MODIFIER_nonmonotonic)) || + ScheduleKind.M2 == OMPC_SCHEDULE_MODIFIER_nonmonotonic)) || ScheduleKind.M1 == OMPC_SCHEDULE_MODIFIER_monotonic || ScheduleKind.M2 == OMPC_SCHEDULE_MODIFIER_monotonic; if ((RT.isStaticNonchunked(ScheduleKind.Schedule, @@ -3552,12 +3562,9 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) { } void CodeGenFunction::EmitOMPSectionDirective(const OMPSectionDirective &S) { - auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) { - CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); - }; - OMPLexicalScope Scope(*this, S, OMPD_unknown); - CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_section, CodeGen, - S.hasCancel()); + LexicalScope Scope(*this, S.getSourceRange()); + EmitStopPoint(&S); + EmitStmt(S.getAssociatedStmt()); } void CodeGenFunction::EmitOMPSingleDirective(const OMPSingleDirective &S) { @@ -3608,7 +3615,7 @@ void CodeGenFunction::EmitOMPSingleDirective(const OMPSingleDirective &S) { static void emitMaster(CodeGenFunction &CGF, const OMPExecutableDirective &S) { auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) { Action.Enter(CGF); - CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); + CGF.EmitStmt(S.getRawStmt()); }; CGF.CGM.getOpenMPRuntime().emitMasterRegion(CGF, CodeGen, S.getBeginLoc()); } @@ -3618,8 +3625,7 @@ void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) { llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder(); using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy; - const CapturedStmt *CS = S.getInnermostCapturedStmt(); - const Stmt *MasterRegionBodyStmt = CS->getCapturedStmt(); + const Stmt *MasterRegionBodyStmt = S.getAssociatedStmt(); auto FiniCB = [this](InsertPointTy IP) { OMPBuilderCBHelpers::FinalizeOMPRegion(*this, IP); @@ -3633,13 +3639,14 @@ void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) { CodeGenIP, FiniBB); }; - CGCapturedStmtInfo CGSI(*CS, CR_OpenMP); - CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(*this, &CGSI); - Builder.restoreIP(OMPBuilder.CreateMaster(Builder, BodyGenCB, FiniCB)); + LexicalScope Scope(*this, S.getSourceRange()); + EmitStopPoint(&S); + Builder.restoreIP(OMPBuilder.createMaster(Builder, BodyGenCB, FiniCB)); return; } - OMPLexicalScope Scope(*this, S, OMPD_unknown); + LexicalScope Scope(*this, S.getSourceRange()); + EmitStopPoint(&S); emitMaster(*this, S); } @@ -3648,8 +3655,7 @@ void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) { llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder(); using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy; - const CapturedStmt *CS = S.getInnermostCapturedStmt(); - const Stmt *CriticalRegionBodyStmt = CS->getCapturedStmt(); + const Stmt *CriticalRegionBodyStmt = S.getAssociatedStmt(); const Expr *Hint = nullptr; if (const auto *HintClause = S.getSingleClause<OMPHintClause>()) Hint = HintClause->getHint(); @@ -3674,9 +3680,9 @@ void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) { CodeGenIP, FiniBB); }; - CGCapturedStmtInfo CGSI(*CS, CR_OpenMP); - CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(*this, &CGSI); - Builder.restoreIP(OMPBuilder.CreateCritical( + LexicalScope Scope(*this, S.getSourceRange()); + EmitStopPoint(&S); + Builder.restoreIP(OMPBuilder.createCritical( Builder, BodyGenCB, FiniCB, S.getDirectiveName().getAsString(), HintInst)); @@ -3685,12 +3691,13 @@ void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) { auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) { Action.Enter(CGF); - CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); + CGF.EmitStmt(S.getAssociatedStmt()); }; const Expr *Hint = nullptr; if (const auto *HintClause = S.getSingleClause<OMPHintClause>()) Hint = HintClause->getHint(); - OMPLexicalScope Scope(*this, S, OMPD_unknown); + LexicalScope Scope(*this, S.getSourceRange()); + EmitStopPoint(&S); CGM.getOpenMPRuntime().emitCriticalRegion(*this, S.getDirectiveName().getAsString(), CodeGen, S.getBeginLoc(), Hint); @@ -3785,6 +3792,42 @@ void CodeGenFunction::EmitOMPParallelSectionsDirective( checkForLastprivateConditionalUpdate(*this, S); } +namespace { +/// Get the list of variables declared in the context of the untied tasks. +class CheckVarsEscapingUntiedTaskDeclContext final + : public ConstStmtVisitor<CheckVarsEscapingUntiedTaskDeclContext> { + llvm::SmallVector<const VarDecl *, 4> PrivateDecls; + +public: + explicit CheckVarsEscapingUntiedTaskDeclContext() = default; + virtual ~CheckVarsEscapingUntiedTaskDeclContext() = default; + void VisitDeclStmt(const DeclStmt *S) { + if (!S) + return; + // Need to privatize only local vars, static locals can be processed as is. + for (const Decl *D : S->decls()) { + if (const auto *VD = dyn_cast_or_null<VarDecl>(D)) + if (VD->hasLocalStorage()) + PrivateDecls.push_back(VD); + } + } + void VisitOMPExecutableDirective(const OMPExecutableDirective *) { return; } + void VisitCapturedStmt(const CapturedStmt *) { return; } + void VisitLambdaExpr(const LambdaExpr *) { return; } + void VisitBlockExpr(const BlockExpr *) { return; } + void VisitStmt(const Stmt *S) { + if (!S) + return; + for (const Stmt *Child : S->children()) + if (Child) + Visit(Child); + } + + /// Swaps list of vars with the provided one. + ArrayRef<const VarDecl *> getPrivateDecls() const { return PrivateDecls; } +}; +} // anonymous namespace + void CodeGenFunction::EmitOMPTaskBasedDirective( const OMPExecutableDirective &S, const OpenMPDirectiveKind CapturedRegion, const RegionCodeGenTy &BodyGen, const TaskGenTy &TaskGen, @@ -3885,14 +3928,23 @@ void CodeGenFunction::EmitOMPTaskBasedDirective( Data.Dependences.emplace_back(C->getDependencyKind(), C->getModifier()); DD.DepExprs.append(C->varlist_begin(), C->varlist_end()); } + // Get list of local vars for untied tasks. + if (!Data.Tied) { + CheckVarsEscapingUntiedTaskDeclContext Checker; + Checker.Visit(S.getInnermostCapturedStmt()->getCapturedStmt()); + Data.PrivateLocals.append(Checker.getPrivateDecls().begin(), + Checker.getPrivateDecls().end()); + } auto &&CodeGen = [&Data, &S, CS, &BodyGen, &LastprivateDstsOrigs, CapturedRegion](CodeGenFunction &CGF, PrePostActionTy &Action) { + llvm::DenseMap<CanonicalDeclPtr<const VarDecl>, std::pair<Address, Address>> + UntiedLocalVars; // Set proper addresses for generated private copies. OMPPrivateScope Scope(CGF); llvm::SmallVector<std::pair<const VarDecl *, Address>, 16> FirstprivatePtrs; if (!Data.PrivateVars.empty() || !Data.FirstprivateVars.empty() || - !Data.LastprivateVars.empty()) { + !Data.LastprivateVars.empty() || !Data.PrivateLocals.empty()) { llvm::FunctionType *CopyFnTy = llvm::FunctionType::get( CGF.Builder.getVoidTy(), {CGF.Builder.getInt8PtrTy()}, true); enum { PrivatesParam = 2, CopyFnParam = 3 }; @@ -3928,6 +3980,17 @@ void CodeGenFunction::EmitOMPTaskBasedDirective( PrivatePtrs.emplace_back(VD, PrivatePtr); CallArgs.push_back(PrivatePtr.getPointer()); } + for (const VarDecl *VD : Data.PrivateLocals) { + QualType Ty = VD->getType().getNonReferenceType(); + if (VD->getType()->isLValueReferenceType()) + Ty = CGF.getContext().getPointerType(Ty); + if (isAllocatableDecl(VD)) + Ty = CGF.getContext().getPointerType(Ty); + Address PrivatePtr = CGF.CreateMemTemp( + CGF.getContext().getPointerType(Ty), ".local.ptr.addr"); + UntiedLocalVars.try_emplace(VD, PrivatePtr, Address::invalid()); + CallArgs.push_back(PrivatePtr.getPointer()); + } CGF.CGM.getOpenMPRuntime().emitOutlinedFunctionCall( CGF, S.getBeginLoc(), {CopyFnTy, CopyFn}, CallArgs); for (const auto &Pair : LastprivateDstsOrigs) { @@ -3946,6 +4009,22 @@ void CodeGenFunction::EmitOMPTaskBasedDirective( CGF.getContext().getDeclAlign(Pair.first)); Scope.addPrivate(Pair.first, [Replacement]() { return Replacement; }); } + // Adjust mapping for internal locals by mapping actual memory instead of + // a pointer to this memory. + for (auto &Pair : UntiedLocalVars) { + if (isAllocatableDecl(Pair.first)) { + llvm::Value *Ptr = CGF.Builder.CreateLoad(Pair.second.first); + Address Replacement(Ptr, CGF.getPointerAlign()); + Pair.getSecond().first = Replacement; + Ptr = CGF.Builder.CreateLoad(Replacement); + Replacement = Address(Ptr, CGF.getContext().getDeclAlign(Pair.first)); + Pair.getSecond().second = Replacement; + } else { + llvm::Value *Ptr = CGF.Builder.CreateLoad(Pair.second.first); + Address Replacement(Ptr, CGF.getContext().getDeclAlign(Pair.first)); + Pair.getSecond().first = Replacement; + } + } } if (Data.Reductions) { OMPPrivateScope FirstprivateScope(CGF); @@ -4040,6 +4119,8 @@ void CodeGenFunction::EmitOMPTaskBasedDirective( } (void)InRedScope.Privatize(); + CGOpenMPRuntime::UntiedTaskLocalDeclsRAII LocalVarsScope(CGF, + UntiedLocalVars); Action.Enter(CGF); BodyGen(CGF); }; @@ -4075,7 +4156,7 @@ createImplicitFirstprivateForType(ASTContext &C, OMPTaskDataTy &Data, PrivateVD->setInitStyle(VarDecl::CInit); PrivateVD->setInit(ImplicitCastExpr::Create(C, ElemType, CK_LValueToRValue, InitRef, /*BasePath=*/nullptr, - VK_RValue)); + VK_RValue, FPOptionsOverride())); Data.FirstprivateVars.emplace_back(OrigRef); Data.FirstprivateCopies.emplace_back(PrivateRef); Data.FirstprivateInits.emplace_back(InitRef); @@ -4111,17 +4192,18 @@ void CodeGenFunction::EmitOMPTargetTaskBasedDirective( VarDecl *BPVD = nullptr; VarDecl *PVD = nullptr; VarDecl *SVD = nullptr; + VarDecl *MVD = nullptr; if (InputInfo.NumberOfTargetItems > 0) { auto *CD = CapturedDecl::Create( getContext(), getContext().getTranslationUnitDecl(), /*NumParams=*/0); llvm::APInt ArrSize(/*numBits=*/32, InputInfo.NumberOfTargetItems); - QualType BaseAndPointersType = getContext().getConstantArrayType( + QualType BaseAndPointerAndMapperType = getContext().getConstantArrayType( getContext().VoidPtrTy, ArrSize, nullptr, ArrayType::Normal, /*IndexTypeQuals=*/0); BPVD = createImplicitFirstprivateForType( - getContext(), Data, BaseAndPointersType, CD, S.getBeginLoc()); + getContext(), Data, BaseAndPointerAndMapperType, CD, S.getBeginLoc()); PVD = createImplicitFirstprivateForType( - getContext(), Data, BaseAndPointersType, CD, S.getBeginLoc()); + getContext(), Data, BaseAndPointerAndMapperType, CD, S.getBeginLoc()); QualType SizesType = getContext().getConstantArrayType( getContext().getIntTypeForBitwidth(/*DestWidth=*/64, /*Signed=*/1), ArrSize, nullptr, ArrayType::Normal, @@ -4134,6 +4216,15 @@ void CodeGenFunction::EmitOMPTargetTaskBasedDirective( [&InputInfo]() { return InputInfo.PointersArray; }); TargetScope.addPrivate(SVD, [&InputInfo]() { return InputInfo.SizesArray; }); + // If there is no user-defined mapper, the mapper array will be nullptr. In + // this case, we don't need to privatize it. + if (!dyn_cast_or_null<llvm::ConstantPointerNull>( + InputInfo.MappersArray.getPointer())) { + MVD = createImplicitFirstprivateForType( + getContext(), Data, BaseAndPointerAndMapperType, CD, S.getBeginLoc()); + TargetScope.addPrivate(MVD, + [&InputInfo]() { return InputInfo.MappersArray; }); + } } (void)TargetScope.Privatize(); // Build list of dependences. @@ -4142,7 +4233,7 @@ void CodeGenFunction::EmitOMPTargetTaskBasedDirective( Data.Dependences.emplace_back(C->getDependencyKind(), C->getModifier()); DD.DepExprs.append(C->varlist_begin(), C->varlist_end()); } - auto &&CodeGen = [&Data, &S, CS, &BodyGen, BPVD, PVD, SVD, + auto &&CodeGen = [&Data, &S, CS, &BodyGen, BPVD, PVD, SVD, MVD, &InputInfo](CodeGenFunction &CGF, PrePostActionTy &Action) { // Set proper addresses for generated private copies. OMPPrivateScope Scope(CGF); @@ -4183,6 +4274,10 @@ void CodeGenFunction::EmitOMPTargetTaskBasedDirective( CGF.GetAddrOfLocalVar(PVD), /*Index=*/0); InputInfo.SizesArray = CGF.Builder.CreateConstArrayGEP( CGF.GetAddrOfLocalVar(SVD), /*Index=*/0); + // If MVD is nullptr, the mapper array is not privatized + if (MVD) + InputInfo.MappersArray = CGF.Builder.CreateConstArrayGEP( + CGF.GetAddrOfLocalVar(MVD), /*Index=*/0); } Action.Enter(CGF); @@ -4769,7 +4864,7 @@ static llvm::Function *emitOutlinedOrderedFunction(CodeGenModule &CGM, void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) { if (S.hasClausesOfKind<OMPDependClause>()) { - assert(!S.getAssociatedStmt() && + assert(!S.hasAssociatedStmt() && "No associated statement must be in ordered depend construct."); for (const auto *DC : S.getClausesOfKind<OMPDependClause>()) CGM.getOpenMPRuntime().emitDoacrossOrdered(*this, DC); @@ -5359,17 +5454,11 @@ void CodeGenFunction::EmitOMPAtomicDirective(const OMPAtomicDirective &S) { } } - const Stmt *CS = S.getInnermostCapturedStmt()->IgnoreContainers(); - - auto &&CodeGen = [&S, Kind, AO, CS](CodeGenFunction &CGF, - PrePostActionTy &) { - CGF.EmitStopPoint(CS); - emitOMPAtomicExpr(CGF, Kind, AO, S.isPostfixUpdate(), S.getX(), S.getV(), - S.getExpr(), S.getUpdateExpr(), S.isXLHSInRHSPart(), - S.getBeginLoc()); - }; - OMPLexicalScope Scope(*this, S, OMPD_unknown); - CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_atomic, CodeGen); + LexicalScope Scope(*this, S.getSourceRange()); + EmitStopPoint(S.getAssociatedStmt()); + emitOMPAtomicExpr(*this, Kind, AO, S.isPostfixUpdate(), S.getX(), S.getV(), + S.getExpr(), S.getUpdateExpr(), S.isXLHSInRHSPart(), + S.getBeginLoc()); } static void emitCommonOMPTargetDirective(CodeGenFunction &CGF, @@ -5887,7 +5976,7 @@ void CodeGenFunction::EmitOMPCancelDirective(const OMPCancelDirective &S) { IfCondition = EmitScalarExpr(IfCond, /*IgnoreResultAssign=*/true); return Builder.restoreIP( - OMPBuilder.CreateCancel(Builder, IfCondition, S.getCancelRegion())); + OMPBuilder.createCancel(Builder, IfCondition, S.getCancelRegion())); } } @@ -6030,7 +6119,8 @@ void CodeGenFunction::EmitOMPUseDeviceAddrClause( // Generate the instructions for '#pragma omp target data' directive. void CodeGenFunction::EmitOMPTargetDataDirective( const OMPTargetDataDirective &S) { - CGOpenMPRuntime::TargetDataInfo Info(/*RequiresDevicePointerInfo=*/true); + CGOpenMPRuntime::TargetDataInfo Info(/*RequiresDevicePointerInfo=*/true, + /*SeparateBeginEndCalls=*/true); // Create a pre/post action to signal the privatization of the device pointer. // This action can be replaced by the OpenMP runtime code generation to @@ -6621,7 +6711,12 @@ void CodeGenFunction::EmitSimpleOMPExecutableDirective( CGF.EmitStmt(D.getInnermostCapturedStmt()->getCapturedStmt()); } }; - { + if (D.getDirectiveKind() == OMPD_atomic || + D.getDirectiveKind() == OMPD_critical || + D.getDirectiveKind() == OMPD_section || + D.getDirectiveKind() == OMPD_master) { + EmitStmt(D.getAssociatedStmt()); + } else { auto LPCRegion = CGOpenMPRuntime::LastprivateConditionalRAII::disable(*this, D); OMPSimdLexicalScope Scope(*this, D); |