@@ -1839,11 +1839,10 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) {
18391839 CodeGenFunction::CGCapturedStmtRAII CapInfoRAII (*this , &CGSI);
18401840 llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
18411841 AllocaInsertPt->getParent (), AllocaInsertPt->getIterator ());
1842- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
1842+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP = cantFail (
18431843 OMPBuilder.createParallel (Builder, AllocaIP, BodyGenCB, PrivCB, FiniCB,
1844- IfCond, NumThreads, ProcBind, S.hasCancel ());
1845- assert (AfterIP && " unexpected error creating parallel" );
1846- Builder.restoreIP (*AfterIP);
1844+ IfCond, NumThreads, ProcBind, S.hasCancel ()));
1845+ Builder.restoreIP (AfterIP);
18471846 return ;
18481847 }
18491848
@@ -2135,10 +2134,8 @@ void CodeGenFunction::EmitOMPCanonicalLoop(const OMPCanonicalLoop *S) {
21352134 return llvm::Error::success ();
21362135 };
21372136
2138- llvm::Expected<llvm::CanonicalLoopInfo *> Result =
2139- OMPBuilder.createCanonicalLoop (Builder, BodyGen, DistVal);
2140- assert (Result && " unexpected error creating canonical loop" );
2141- llvm::CanonicalLoopInfo *CL = *Result;
2137+ llvm::CanonicalLoopInfo *CL =
2138+ cantFail (OMPBuilder.createCanonicalLoop (Builder, BodyGen, DistVal));
21422139
21432140 // Finish up the loop.
21442141 Builder.restoreIP (CL->getAfterIP ());
@@ -4024,13 +4021,11 @@ static void emitOMPForDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
40244021 CGM.getOpenMPRuntime ().getOMPBuilder ();
40254022 llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
40264023 CGF.AllocaInsertPt ->getParent (), CGF.AllocaInsertPt ->getIterator ());
4027- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
4028- OMPBuilder.applyWorkshareLoop (
4029- CGF.Builder .getCurrentDebugLocation (), CLI, AllocaIP,
4030- NeedsBarrier, SchedKind, ChunkSize, /* HasSimdModifier=*/ false ,
4031- /* HasMonotonicModifier=*/ false , /* HasNonmonotonicModifier=*/ false ,
4032- /* HasOrderedClause=*/ false );
4033- assert (AfterIP && " unexpected error creating workshare loop" );
4024+ cantFail (OMPBuilder.applyWorkshareLoop (
4025+ CGF.Builder .getCurrentDebugLocation (), CLI, AllocaIP, NeedsBarrier,
4026+ SchedKind, ChunkSize, /* HasSimdModifier=*/ false ,
4027+ /* HasMonotonicModifier=*/ false , /* HasNonmonotonicModifier=*/ false ,
4028+ /* HasOrderedClause=*/ false ));
40344029 return ;
40354030 }
40364031
@@ -4311,12 +4306,11 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
43114306 CodeGenFunction::CGCapturedStmtRAII CapInfoRAII (*this , &CGSI);
43124307 llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
43134308 AllocaInsertPt->getParent (), AllocaInsertPt->getIterator ());
4314- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
4315- OMPBuilder.createSections (Builder, AllocaIP, SectionCBVector, PrivCB,
4316- FiniCB, S.hasCancel (),
4317- S.getSingleClause <OMPNowaitClause>());
4318- assert (AfterIP && " unexpected error creating sections" );
4319- Builder.restoreIP (*AfterIP);
4309+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP =
4310+ cantFail (OMPBuilder.createSections (
4311+ Builder, AllocaIP, SectionCBVector, PrivCB, FiniCB, S.hasCancel (),
4312+ S.getSingleClause <OMPNowaitClause>()));
4313+ Builder.restoreIP (AfterIP);
43204314 return ;
43214315 }
43224316 {
@@ -4354,10 +4348,9 @@ void CodeGenFunction::EmitOMPSectionDirective(const OMPSectionDirective &S) {
43544348
43554349 LexicalScope Scope (*this , S.getSourceRange ());
43564350 EmitStopPoint (&S);
4357- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
4358- OMPBuilder.createSection (Builder, BodyGenCB, FiniCB);
4359- assert (AfterIP && " unexpected error creating section" );
4360- Builder.restoreIP (*AfterIP);
4351+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP =
4352+ cantFail (OMPBuilder.createSection (Builder, BodyGenCB, FiniCB));
4353+ Builder.restoreIP (AfterIP);
43614354
43624355 return ;
43634356 }
@@ -4440,10 +4433,9 @@ void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) {
44404433
44414434 LexicalScope Scope (*this , S.getSourceRange ());
44424435 EmitStopPoint (&S);
4443- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
4444- OMPBuilder.createMaster (Builder, BodyGenCB, FiniCB);
4445- assert (AfterIP && " unexpected error creating master" );
4446- Builder.restoreIP (*AfterIP);
4436+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP =
4437+ cantFail (OMPBuilder.createMaster (Builder, BodyGenCB, FiniCB));
4438+ Builder.restoreIP (AfterIP);
44474439
44484440 return ;
44494441 }
@@ -4491,10 +4483,9 @@ void CodeGenFunction::EmitOMPMaskedDirective(const OMPMaskedDirective &S) {
44914483
44924484 LexicalScope Scope (*this , S.getSourceRange ());
44934485 EmitStopPoint (&S);
4494- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
4495- OMPBuilder.createMasked (Builder, BodyGenCB, FiniCB, FilterVal);
4496- assert (AfterIP && " unexpected error creating masked" );
4497- Builder.restoreIP (*AfterIP);
4486+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP = cantFail (
4487+ OMPBuilder.createMasked (Builder, BodyGenCB, FiniCB, FilterVal));
4488+ Builder.restoreIP (AfterIP);
44984489
44994490 return ;
45004491 }
@@ -4535,11 +4526,11 @@ void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) {
45354526
45364527 LexicalScope Scope (*this , S.getSourceRange ());
45374528 EmitStopPoint (&S);
4538- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
4539- OMPBuilder.createCritical (Builder, BodyGenCB, FiniCB,
4540- S.getDirectiveName ().getAsString (), HintInst);
4541- assert (AfterIP && " unexpected error creating critical " );
4542- Builder.restoreIP (* AfterIP);
4529+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP =
4530+ cantFail ( OMPBuilder.createCritical (Builder, BodyGenCB, FiniCB,
4531+ S.getDirectiveName ().getAsString (),
4532+ HintInst) );
4533+ Builder.restoreIP (AfterIP);
45434534
45444535 return ;
45454536 }
@@ -5503,10 +5494,9 @@ void CodeGenFunction::EmitOMPTaskgroupDirective(
55035494 CodeGenFunction::CGCapturedStmtInfo CapStmtInfo;
55045495 if (!CapturedStmtInfo)
55055496 CapturedStmtInfo = &CapStmtInfo;
5506- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
5507- OMPBuilder.createTaskgroup (Builder, AllocaIP, BodyGenCB);
5508- assert (AfterIP && " unexpected error creating taskgroup" );
5509- Builder.restoreIP (*AfterIP);
5497+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP =
5498+ cantFail (OMPBuilder.createTaskgroup (Builder, AllocaIP, BodyGenCB));
5499+ Builder.restoreIP (AfterIP);
55105500 return ;
55115501 }
55125502 auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) {
@@ -6109,10 +6099,9 @@ void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) {
61096099 };
61106100
61116101 OMPLexicalScope Scope (*this , S, OMPD_unknown);
6112- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
6113- OMPBuilder.createOrderedThreadsSimd (Builder, BodyGenCB, FiniCB, !C);
6114- assert (AfterIP && " unexpected error creating ordered" );
6115- Builder.restoreIP (*AfterIP);
6102+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP = cantFail (
6103+ OMPBuilder.createOrderedThreadsSimd (Builder, BodyGenCB, FiniCB, !C));
6104+ Builder.restoreIP (AfterIP);
61166105 }
61176106 return ;
61186107 }
@@ -7388,10 +7377,9 @@ void CodeGenFunction::EmitOMPCancelDirective(const OMPCancelDirective &S) {
73887377 if (IfCond)
73897378 IfCondition = EmitScalarExpr (IfCond,
73907379 /* IgnoreResultAssign=*/ true );
7391- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
7392- OMPBuilder.createCancel (Builder, IfCondition, S.getCancelRegion ());
7393- assert (AfterIP && " unexpected error creating cancel" );
7394- return Builder.restoreIP (*AfterIP);
7380+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP = cantFail (
7381+ OMPBuilder.createCancel (Builder, IfCondition, S.getCancelRegion ()));
7382+ return Builder.restoreIP (AfterIP);
73957383 }
73967384 }
73977385
0 commit comments