// 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[] = {
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,
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;
}
#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
// 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