forked from OSchip/llvm-project
[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
This commit is contained in:
parent
a975959996
commit
9619f04c0e
|
@ -3685,8 +3685,6 @@ void CGOpenMPRuntime::emitCancelCall(CodeGenFunction &CGF, SourceLocation Loc,
|
|||
// kmp_int32 cncl_kind);
|
||||
if (auto *OMPRegionInfo =
|
||||
dyn_cast_or_null<CGOpenMPRegionInfo>(CGF.CapturedStmtInfo)) {
|
||||
if (OMPRegionInfo->getDirectiveKind() == OMPD_single)
|
||||
return;
|
||||
auto &&ThenGen = [this, Loc, CancelRegion,
|
||||
OMPRegionInfo](CodeGenFunction &CGF) {
|
||||
llvm::Value *Args[] = {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ int main (int argc, char **argv) {
|
|||
#pragma omp cancel sections
|
||||
}
|
||||
// CHECK: call i32 @__kmpc_single(
|
||||
// CHECK-NOT: @__kmpc_cancel
|
||||
// CHECK: call i32 @__kmpc_cancel(
|
||||
// CHECK: call void @__kmpc_end_single(
|
||||
// CHECK: call void @__kmpc_barrier(%ident_t*
|
||||
#pragma omp sections
|
||||
|
@ -126,7 +126,7 @@ for (int i = 0; i < argc; ++i) {
|
|||
|
||||
// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}})
|
||||
// CHECK: call i32 @__kmpc_single(
|
||||
// CHECK-NOT: @__kmpc_cancel
|
||||
// CHECK: call i32 @__kmpc_cancel(
|
||||
// CHECK: call void @__kmpc_end_single(
|
||||
// CHECK: ret void
|
||||
|
||||
|
|
Loading…
Reference in New Issue