diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 7 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 43 |
3 files changed, 23 insertions, 29 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 59a0b27f168..51865a6141f 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1047,16 +1047,9 @@ InlinedOpenMPRegionRAII::InlinedOpenMPRegionRAII( CodeGenFunction &CGF, const OMPExecutableDirective &D) : CGF(CGF) { CGF.CapturedStmtInfo = new CGOpenMPInlinedRegionInfo(D, CGF.CapturedStmtInfo); - // 1.2.2 OpenMP Language Terminology - // Structured block - An executable statement with a single entry at the - // top and a single exit at the bottom. - // The point of exit cannot be a branch out of the structured block. - // longjmp() and throw() must not violate the entry/exit criteria. - CGF.EHStack.pushTerminate(); } InlinedOpenMPRegionRAII::~InlinedOpenMPRegionRAII() { - CGF.EHStack.popTerminate(); auto *OldCSI = cast<CGOpenMPInlinedRegionInfo>(CGF.CapturedStmtInfo)->getOldCSI(); delete CGF.CapturedStmtInfo; diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index e4339849ca3..0d160d3eee5 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -2186,8 +2186,6 @@ CodeGenFunction::GenerateCapturedStmtFunction(const CapturedStmt &S) { llvm::Function::Create(FuncLLVMTy, llvm::GlobalValue::InternalLinkage, CapturedStmtInfo->getHelperName(), &CGM.getModule()); CGM.SetInternalFunctionAttributes(CD, F, FuncInfo); - if (CD->isNothrow()) - F->addFnAttr(llvm::Attribute::NoUnwind); // Generate the function. StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args, diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 245fed01e52..c83dfa17064 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -23,20 +23,6 @@ using namespace CodeGen; //===----------------------------------------------------------------------===// // OpenMP Directive Emission //===----------------------------------------------------------------------===// -namespace { -/// \brief RAII for inlined OpenMP regions (like 'omp for', 'omp simd', 'omp -/// critical' etc.). Helps to generate proper debug info and provides correct -/// code generation for such constructs. -class InlinedOpenMPRegionScopeRAII { - InlinedOpenMPRegionRAII Region; - CodeGenFunction::LexicalScope DirectiveScope; - -public: - InlinedOpenMPRegionScopeRAII(CodeGenFunction &CGF, - const OMPExecutableDirective &D) - : Region(CGF, D), DirectiveScope(CGF, D.getSourceRange()) {} -}; -} // namespace /// \brief Emits code for OpenMP 'if' clause using specified \a CodeGen /// function. Here is the logic: @@ -431,7 +417,12 @@ void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { } } - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope DirectiveScope(*this); + + CGDebugInfo *DI = getDebugInfo(); + if (DI) + DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); // Emit the loop iteration variable. const Expr *IVExpr = S.getIterationVariable(); @@ -475,6 +466,9 @@ void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { } EmitOMPSimdFinal(S); } + + if (DI) + DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); } void CodeGenFunction::EmitOMPForOuterLoop(OpenMPScheduleClauseKind ScheduleKind, @@ -656,13 +650,20 @@ void CodeGenFunction::EmitOMPWorksharingLoop(const OMPLoopDirective &S) { } void CodeGenFunction::EmitOMPForDirective(const OMPForDirective &S) { - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope DirectiveScope(*this); + + CGDebugInfo *DI = getDebugInfo(); + if (DI) + DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); EmitOMPWorksharingLoop(S); // Emit an implicit barrier at the end. CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getLocStart(), /*IsExplicit*/ false); + if (DI) + DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); } void CodeGenFunction::EmitOMPForSimdDirective(const OMPForSimdDirective &) { @@ -679,7 +680,8 @@ void CodeGenFunction::EmitOMPSectionDirective(const OMPSectionDirective &) { void CodeGenFunction::EmitOMPSingleDirective(const OMPSingleDirective &S) { CGM.getOpenMPRuntime().emitSingleRegion(*this, [&]() -> void { - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope Scope(*this); EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt()); EnsureInsertPoint(); }, S.getLocStart()); @@ -687,7 +689,8 @@ void CodeGenFunction::EmitOMPSingleDirective(const OMPSingleDirective &S) { void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) { CGM.getOpenMPRuntime().emitMasterRegion(*this, [&]() -> void { - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope Scope(*this); EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt()); EnsureInsertPoint(); }, S.getLocStart()); @@ -696,7 +699,8 @@ void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) { void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) { CGM.getOpenMPRuntime().emitCriticalRegion( *this, S.getDirectiveName().getAsString(), [&]() -> void { - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope Scope(*this); EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt()); EnsureInsertPoint(); }, S.getLocStart()); @@ -894,7 +898,6 @@ void CodeGenFunction::EmitOMPAtomicDirective(const OMPAtomicDirective &S) { break; } } - InlinedOpenMPRegionScopeRAII Region(*this, S); EmitOMPAtomicExpr(*this, Kind, IsSeqCst, S.getX(), S.getV(), S.getExpr(), S.getLocStart()); } |