summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmtOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-01-20 12:29:47 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-01-20 12:29:47 +0000
commit9619f04c0e12c24b1282f6d4449de4a9228c3060 (patch)
treef416f941f9130797a0ca6554668ad9795f3f0208 /clang/lib/CodeGen/CGStmtOpenMP.cpp
parenta97595999653b2a2c79a7efd10bfce4fdcf15b44 (diff)
downloadbcm5719-llvm-9619f04c0e12c24b1282f6d4449de4a9228c3060.tar.gz
bcm5719-llvm-9619f04c0e12c24b1282f6d4449de4a9228c3060.zip
[OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' directive.
Allow to emit code for 'cancel' directive within 'sections' directive with single sub-section. llvm-svn: 258307
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 793e1a97314..1507f84aeee 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1786,7 +1786,11 @@ CodeGenFunction::EmitSections(const OMPExecutableDirective &S) {
CGF.EmitOMPPrivateClause(S, SingleScope);
(void)SingleScope.Privatize();
+ auto Exit = CGF.getJumpDestInCurrentScope("omp.sections.exit");
+ CGF.BreakContinueStack.push_back(BreakContinue(Exit, Exit));
CGF.EmitStmt(Stmt);
+ CGF.EmitBlock(Exit.getBlock());
+ CGF.BreakContinueStack.pop_back();
};
CGM.getOpenMPRuntime().emitSingleRegion(*this, CodeGen, S.getLocStart(),
llvm::None, llvm::None, llvm::None,
@@ -2647,7 +2651,8 @@ CodeGenFunction::getOMPCancelDestination(OpenMPDirectiveKind Kind) {
if (Kind == OMPD_parallel || Kind == OMPD_task)
return ReturnBlock;
assert(Kind == OMPD_for || Kind == OMPD_section || Kind == OMPD_sections ||
- Kind == OMPD_parallel_sections || Kind == OMPD_parallel_for);
+ Kind == OMPD_parallel_sections || Kind == OMPD_parallel_for ||
+ Kind == OMPD_single);
return BreakContinueStack.back().BreakBlock;
}
OpenPOWER on IntegriCloud