@@ -1839,11 +1839,10 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) {
1839
1839
CodeGenFunction::CGCapturedStmtRAII CapInfoRAII (*this , &CGSI);
1840
1840
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
1841
1841
AllocaInsertPt->getParent (), AllocaInsertPt->getIterator ());
1842
- llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
1842
+ llvm::OpenMPIRBuilder::InsertPointTy AfterIP = cantFail (
1843
1843
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);
1847
1846
return ;
1848
1847
}
1849
1848
@@ -2135,10 +2134,8 @@ void CodeGenFunction::EmitOMPCanonicalLoop(const OMPCanonicalLoop *S) {
2135
2134
return llvm::Error::success ();
2136
2135
};
2137
2136
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));
2142
2139
2143
2140
// Finish up the loop.
2144
2141
Builder.restoreIP (CL->getAfterIP ());
@@ -4024,13 +4021,11 @@ static void emitOMPForDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
4024
4021
CGM.getOpenMPRuntime ().getOMPBuilder ();
4025
4022
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
4026
4023
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 ));
4034
4029
return ;
4035
4030
}
4036
4031
@@ -4311,12 +4306,11 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
4311
4306
CodeGenFunction::CGCapturedStmtRAII CapInfoRAII (*this , &CGSI);
4312
4307
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
4313
4308
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);
4320
4314
return ;
4321
4315
}
4322
4316
{
@@ -4354,10 +4348,9 @@ void CodeGenFunction::EmitOMPSectionDirective(const OMPSectionDirective &S) {
4354
4348
4355
4349
LexicalScope Scope (*this , S.getSourceRange ());
4356
4350
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);
4361
4354
4362
4355
return ;
4363
4356
}
@@ -4440,10 +4433,9 @@ void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) {
4440
4433
4441
4434
LexicalScope Scope (*this , S.getSourceRange ());
4442
4435
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);
4447
4439
4448
4440
return ;
4449
4441
}
@@ -4491,10 +4483,9 @@ void CodeGenFunction::EmitOMPMaskedDirective(const OMPMaskedDirective &S) {
4491
4483
4492
4484
LexicalScope Scope (*this , S.getSourceRange ());
4493
4485
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);
4498
4489
4499
4490
return ;
4500
4491
}
@@ -4535,11 +4526,11 @@ void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) {
4535
4526
4536
4527
LexicalScope Scope (*this , S.getSourceRange ());
4537
4528
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);
4543
4534
4544
4535
return ;
4545
4536
}
@@ -5503,10 +5494,9 @@ void CodeGenFunction::EmitOMPTaskgroupDirective(
5503
5494
CodeGenFunction::CGCapturedStmtInfo CapStmtInfo;
5504
5495
if (!CapturedStmtInfo)
5505
5496
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);
5510
5500
return ;
5511
5501
}
5512
5502
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) {
@@ -6109,10 +6099,9 @@ void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) {
6109
6099
};
6110
6100
6111
6101
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);
6116
6105
}
6117
6106
return ;
6118
6107
}
@@ -7388,10 +7377,9 @@ void CodeGenFunction::EmitOMPCancelDirective(const OMPCancelDirective &S) {
7388
7377
if (IfCond)
7389
7378
IfCondition = EmitScalarExpr (IfCond,
7390
7379
/* 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);
7395
7383
}
7396
7384
}
7397
7385
0 commit comments