@@ -1809,6 +1809,7 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) {
18091809 // thus calls destructors etc.
18101810 auto FiniCB = [this ](InsertPointTy IP) {
18111811 OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
1812+ return llvm::Error::success ();
18121813 };
18131814
18141815 // Privatization callback that performs appropriate action for
@@ -1831,15 +1832,18 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) {
18311832 InsertPointTy CodeGenIP) {
18321833 OMPBuilderCBHelpers::EmitOMPOutlinedRegionBody (
18331834 *this , ParallelRegionBodyStmt, AllocaIP, CodeGenIP, " parallel" );
1835+ return llvm::Error::success ();
18341836 };
18351837
18361838 CGCapturedStmtInfo CGSI (*CS, CR_OpenMP);
18371839 CodeGenFunction::CGCapturedStmtRAII CapInfoRAII (*this , &CGSI);
18381840 llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
18391841 AllocaInsertPt->getParent (), AllocaInsertPt->getIterator ());
1840- Builder. restoreIP (
1842+ auto Result =
18411843 OMPBuilder.createParallel (Builder, AllocaIP, BodyGenCB, PrivCB, FiniCB,
1842- IfCond, NumThreads, ProcBind, S.hasCancel ()));
1844+ IfCond, NumThreads, ProcBind, S.hasCancel ());
1845+ assert (Result && " unexpected error creating parallel" );
1846+ Builder.restoreIP (*Result);
18431847 return ;
18441848 }
18451849
@@ -2128,9 +2132,12 @@ void CodeGenFunction::EmitOMPCanonicalLoop(const OMPCanonicalLoop *S) {
21282132
21292133 RunCleanupsScope BodyScope (*this );
21302134 EmitStmt (BodyStmt);
2135+ return llvm::Error::success ();
21312136 };
2132- llvm::CanonicalLoopInfo *CL =
2133- OMPBuilder.createCanonicalLoop (Builder, BodyGen, DistVal);
2137+
2138+ auto Result = OMPBuilder.createCanonicalLoop (Builder, BodyGen, DistVal);
2139+ assert (Result && " unexpected error creating parallel" );
2140+ llvm::CanonicalLoopInfo *CL = *Result;
21342141
21352142 // Finish up the loop.
21362143 Builder.restoreIP (CL->getAfterIP ());
@@ -4016,11 +4023,12 @@ static void emitOMPForDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
40164023 CGM.getOpenMPRuntime ().getOMPBuilder ();
40174024 llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
40184025 CGF.AllocaInsertPt ->getParent (), CGF.AllocaInsertPt ->getIterator ());
4019- OMPBuilder.applyWorkshareLoop (
4026+ auto Result = OMPBuilder.applyWorkshareLoop (
40204027 CGF.Builder .getCurrentDebugLocation (), CLI, AllocaIP, NeedsBarrier,
40214028 SchedKind, ChunkSize, /* HasSimdModifier=*/ false ,
40224029 /* HasMonotonicModifier=*/ false , /* HasNonmonotonicModifier=*/ false ,
40234030 /* HasOrderedClause=*/ false );
4031+ assert (Result && " unexpected error creating workshare loop" );
40244032 return ;
40254033 }
40264034
@@ -4257,6 +4265,7 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
42574265
42584266 auto FiniCB = [this ](InsertPointTy IP) {
42594267 OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4268+ return llvm::Error::success ();
42604269 };
42614270
42624271 const CapturedStmt *ICS = S.getInnermostCapturedStmt ();
@@ -4269,6 +4278,7 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
42694278 InsertPointTy CodeGenIP) {
42704279 OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
42714280 *this , SubStmt, AllocaIP, CodeGenIP, " section" );
4281+ return llvm::Error::success ();
42724282 };
42734283 SectionCBVector.push_back (SectionCB);
42744284 }
@@ -4277,6 +4287,7 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
42774287 InsertPointTy CodeGenIP) {
42784288 OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
42794289 *this , CapturedStmt, AllocaIP, CodeGenIP, " section" );
4290+ return llvm::Error::success ();
42804291 };
42814292 SectionCBVector.push_back (SectionCB);
42824293 }
@@ -4298,9 +4309,11 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
42984309 CodeGenFunction::CGCapturedStmtRAII CapInfoRAII (*this , &CGSI);
42994310 llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
43004311 AllocaInsertPt->getParent (), AllocaInsertPt->getIterator ());
4301- Builder. restoreIP ( OMPBuilder.createSections (
4312+ auto Result = OMPBuilder.createSections (
43024313 Builder, AllocaIP, SectionCBVector, PrivCB, FiniCB, S.hasCancel (),
4303- S.getSingleClause <OMPNowaitClause>()));
4314+ S.getSingleClause <OMPNowaitClause>());
4315+ assert (Result && " unexpected error creating sections" );
4316+ Builder.restoreIP (*Result);
43044317 return ;
43054318 }
43064319 {
@@ -4326,17 +4339,21 @@ void CodeGenFunction::EmitOMPSectionDirective(const OMPSectionDirective &S) {
43264339 const Stmt *SectionRegionBodyStmt = S.getAssociatedStmt ();
43274340 auto FiniCB = [this ](InsertPointTy IP) {
43284341 OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4342+ return llvm::Error::success ();
43294343 };
43304344
43314345 auto BodyGenCB = [SectionRegionBodyStmt, this ](InsertPointTy AllocaIP,
43324346 InsertPointTy CodeGenIP) {
43334347 OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
43344348 *this , SectionRegionBodyStmt, AllocaIP, CodeGenIP, " section" );
4349+ return llvm::Error::success ();
43354350 };
43364351
43374352 LexicalScope Scope (*this , S.getSourceRange ());
43384353 EmitStopPoint (&S);
4339- Builder.restoreIP (OMPBuilder.createSection (Builder, BodyGenCB, FiniCB));
4354+ auto Result = OMPBuilder.createSection (Builder, BodyGenCB, FiniCB);
4355+ assert (Result && " unexpected error creating section" );
4356+ Builder.restoreIP (*Result);
43404357
43414358 return ;
43424359 }
@@ -4407,17 +4424,21 @@ void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) {
44074424
44084425 auto FiniCB = [this ](InsertPointTy IP) {
44094426 OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4427+ return llvm::Error::success ();
44104428 };
44114429
44124430 auto BodyGenCB = [MasterRegionBodyStmt, this ](InsertPointTy AllocaIP,
44134431 InsertPointTy CodeGenIP) {
44144432 OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
44154433 *this , MasterRegionBodyStmt, AllocaIP, CodeGenIP, " master" );
4434+ return llvm::Error::success ();
44164435 };
44174436
44184437 LexicalScope Scope (*this , S.getSourceRange ());
44194438 EmitStopPoint (&S);
4420- Builder.restoreIP (OMPBuilder.createMaster (Builder, BodyGenCB, FiniCB));
4439+ auto Result = OMPBuilder.createMaster (Builder, BodyGenCB, FiniCB);
4440+ assert (Result && " unexpected error creating master" );
4441+ Builder.restoreIP (*Result);
44214442
44224443 return ;
44234444 }
@@ -4453,18 +4474,22 @@ void CodeGenFunction::EmitOMPMaskedDirective(const OMPMaskedDirective &S) {
44534474
44544475 auto FiniCB = [this ](InsertPointTy IP) {
44554476 OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4477+ return llvm::Error::success ();
44564478 };
44574479
44584480 auto BodyGenCB = [MaskedRegionBodyStmt, this ](InsertPointTy AllocaIP,
44594481 InsertPointTy CodeGenIP) {
44604482 OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
44614483 *this , MaskedRegionBodyStmt, AllocaIP, CodeGenIP, " masked" );
4484+ return llvm::Error::success ();
44624485 };
44634486
44644487 LexicalScope Scope (*this , S.getSourceRange ());
44654488 EmitStopPoint (&S);
4466- Builder.restoreIP (
4467- OMPBuilder.createMasked (Builder, BodyGenCB, FiniCB, FilterVal));
4489+ auto Result =
4490+ OMPBuilder.createMasked (Builder, BodyGenCB, FiniCB, FilterVal);
4491+ assert (Result && " unexpected error creating masked" );
4492+ Builder.restoreIP (*Result);
44684493
44694494 return ;
44704495 }
@@ -4493,19 +4518,23 @@ void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) {
44934518
44944519 auto FiniCB = [this ](InsertPointTy IP) {
44954520 OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4521+ return llvm::Error::success ();
44964522 };
44974523
44984524 auto BodyGenCB = [CriticalRegionBodyStmt, this ](InsertPointTy AllocaIP,
44994525 InsertPointTy CodeGenIP) {
45004526 OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
45014527 *this , CriticalRegionBodyStmt, AllocaIP, CodeGenIP, " critical" );
4528+ return llvm::Error::success ();
45024529 };
45034530
45044531 LexicalScope Scope (*this , S.getSourceRange ());
45054532 EmitStopPoint (&S);
4506- Builder.restoreIP (OMPBuilder.createCritical (
4507- Builder, BodyGenCB, FiniCB, S.getDirectiveName ().getAsString (),
4508- HintInst));
4533+ auto Result =
4534+ OMPBuilder.createCritical (Builder, BodyGenCB, FiniCB,
4535+ S.getDirectiveName ().getAsString (), HintInst);
4536+ assert (Result && " unexpected error creating critical" );
4537+ Builder.restoreIP (*Result);
45094538
45104539 return ;
45114540 }
@@ -5464,11 +5493,14 @@ void CodeGenFunction::EmitOMPTaskgroupDirective(
54645493 InsertPointTy CodeGenIP) {
54655494 Builder.restoreIP (CodeGenIP);
54665495 EmitStmt (S.getInnermostCapturedStmt ()->getCapturedStmt ());
5496+ return llvm::Error::success ();
54675497 };
54685498 CodeGenFunction::CGCapturedStmtInfo CapStmtInfo;
54695499 if (!CapturedStmtInfo)
54705500 CapturedStmtInfo = &CapStmtInfo;
5471- Builder.restoreIP (OMPBuilder.createTaskgroup (Builder, AllocaIP, BodyGenCB));
5501+ auto Result = OMPBuilder.createTaskgroup (Builder, AllocaIP, BodyGenCB);
5502+ assert (Result && " unexpected error creating taskgroup" );
5503+ Builder.restoreIP (*Result);
54725504 return ;
54735505 }
54745506 auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) {
@@ -6041,6 +6073,7 @@ void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) {
60416073
60426074 auto FiniCB = [this ](InsertPointTy IP) {
60436075 OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
6076+ return llvm::Error::success ();
60446077 };
60456078
60466079 auto BodyGenCB = [&S, C, this ](InsertPointTy AllocaIP,
@@ -6064,11 +6097,14 @@ void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) {
60646097 OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
60656098 *this , CS->getCapturedStmt (), AllocaIP, CodeGenIP, " ordered" );
60666099 }
6100+ return llvm::Error::success ();
60676101 };
60686102
60696103 OMPLexicalScope Scope (*this , S, OMPD_unknown);
6070- Builder.restoreIP (
6071- OMPBuilder.createOrderedThreadsSimd (Builder, BodyGenCB, FiniCB, !C));
6104+ auto Result =
6105+ OMPBuilder.createOrderedThreadsSimd (Builder, BodyGenCB, FiniCB, !C);
6106+ assert (Result && " unexpected error creating ordered" );
6107+ Builder.restoreIP (*Result);
60726108 }
60736109 return ;
60746110 }
@@ -7344,8 +7380,10 @@ void CodeGenFunction::EmitOMPCancelDirective(const OMPCancelDirective &S) {
73447380 if (IfCond)
73457381 IfCondition = EmitScalarExpr (IfCond,
73467382 /* IgnoreResultAssign=*/ true );
7347- return Builder.restoreIP (
7348- OMPBuilder.createCancel (Builder, IfCondition, S.getCancelRegion ()));
7383+ auto Result =
7384+ OMPBuilder.createCancel (Builder, IfCondition, S.getCancelRegion ());
7385+ assert (Result && " unexpected error creating cancel" );
7386+ return Builder.restoreIP (*Result);
73497387 }
73507388 }
73517389
0 commit comments