@@ -1809,6 +1809,7 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) {
1809
1809
// thus calls destructors etc.
1810
1810
auto FiniCB = [this ](InsertPointTy IP) {
1811
1811
OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
1812
+ return llvm::Error::success ();
1812
1813
};
1813
1814
1814
1815
// Privatization callback that performs appropriate action for
@@ -1831,15 +1832,18 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) {
1831
1832
InsertPointTy CodeGenIP) {
1832
1833
OMPBuilderCBHelpers::EmitOMPOutlinedRegionBody (
1833
1834
*this , ParallelRegionBodyStmt, AllocaIP, CodeGenIP, " parallel" );
1835
+ return llvm::Error::success ();
1834
1836
};
1835
1837
1836
1838
CGCapturedStmtInfo CGSI (*CS, CR_OpenMP);
1837
1839
CodeGenFunction::CGCapturedStmtRAII CapInfoRAII (*this , &CGSI);
1838
1840
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
1839
1841
AllocaInsertPt->getParent (), AllocaInsertPt->getIterator ());
1840
- Builder. restoreIP (
1842
+ llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
1841
1843
OMPBuilder.createParallel (Builder, AllocaIP, BodyGenCB, PrivCB, FiniCB,
1842
- IfCond, NumThreads, ProcBind, S.hasCancel ()));
1844
+ IfCond, NumThreads, ProcBind, S.hasCancel ());
1845
+ assert (AfterIP && " unexpected error creating parallel" );
1846
+ Builder.restoreIP (*AfterIP);
1843
1847
return ;
1844
1848
}
1845
1849
@@ -2128,9 +2132,13 @@ void CodeGenFunction::EmitOMPCanonicalLoop(const OMPCanonicalLoop *S) {
2128
2132
2129
2133
RunCleanupsScope BodyScope (*this );
2130
2134
EmitStmt (BodyStmt);
2135
+ return llvm::Error::success ();
2131
2136
};
2132
- llvm::CanonicalLoopInfo *CL =
2137
+
2138
+ llvm::Expected<llvm::CanonicalLoopInfo *> Result =
2133
2139
OMPBuilder.createCanonicalLoop (Builder, BodyGen, DistVal);
2140
+ assert (Result && " unexpected error creating canonical loop" );
2141
+ llvm::CanonicalLoopInfo *CL = *Result;
2134
2142
2135
2143
// Finish up the loop.
2136
2144
Builder.restoreIP (CL->getAfterIP ());
@@ -4016,11 +4024,13 @@ static void emitOMPForDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
4016
4024
CGM.getOpenMPRuntime ().getOMPBuilder ();
4017
4025
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
4018
4026
CGF.AllocaInsertPt ->getParent (), CGF.AllocaInsertPt ->getIterator ());
4019
- OMPBuilder.applyWorkshareLoop (
4020
- CGF.Builder .getCurrentDebugLocation (), CLI, AllocaIP, NeedsBarrier,
4021
- SchedKind, ChunkSize, /* HasSimdModifier=*/ false ,
4022
- /* HasMonotonicModifier=*/ false , /* HasNonmonotonicModifier=*/ false ,
4023
- /* HasOrderedClause=*/ false );
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
4034
return ;
4025
4035
}
4026
4036
@@ -4257,6 +4267,7 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
4257
4267
4258
4268
auto FiniCB = [this ](InsertPointTy IP) {
4259
4269
OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4270
+ return llvm::Error::success ();
4260
4271
};
4261
4272
4262
4273
const CapturedStmt *ICS = S.getInnermostCapturedStmt ();
@@ -4269,6 +4280,7 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
4269
4280
InsertPointTy CodeGenIP) {
4270
4281
OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
4271
4282
*this , SubStmt, AllocaIP, CodeGenIP, " section" );
4283
+ return llvm::Error::success ();
4272
4284
};
4273
4285
SectionCBVector.push_back (SectionCB);
4274
4286
}
@@ -4277,6 +4289,7 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
4277
4289
InsertPointTy CodeGenIP) {
4278
4290
OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
4279
4291
*this , CapturedStmt, AllocaIP, CodeGenIP, " section" );
4292
+ return llvm::Error::success ();
4280
4293
};
4281
4294
SectionCBVector.push_back (SectionCB);
4282
4295
}
@@ -4298,9 +4311,12 @@ void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
4298
4311
CodeGenFunction::CGCapturedStmtRAII CapInfoRAII (*this , &CGSI);
4299
4312
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP (
4300
4313
AllocaInsertPt->getParent (), AllocaInsertPt->getIterator ());
4301
- Builder.restoreIP (OMPBuilder.createSections (
4302
- Builder, AllocaIP, SectionCBVector, PrivCB, FiniCB, S.hasCancel (),
4303
- S.getSingleClause <OMPNowaitClause>()));
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);
4304
4320
return ;
4305
4321
}
4306
4322
{
@@ -4326,17 +4342,22 @@ void CodeGenFunction::EmitOMPSectionDirective(const OMPSectionDirective &S) {
4326
4342
const Stmt *SectionRegionBodyStmt = S.getAssociatedStmt ();
4327
4343
auto FiniCB = [this ](InsertPointTy IP) {
4328
4344
OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4345
+ return llvm::Error::success ();
4329
4346
};
4330
4347
4331
4348
auto BodyGenCB = [SectionRegionBodyStmt, this ](InsertPointTy AllocaIP,
4332
4349
InsertPointTy CodeGenIP) {
4333
4350
OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
4334
4351
*this , SectionRegionBodyStmt, AllocaIP, CodeGenIP, " section" );
4352
+ return llvm::Error::success ();
4335
4353
};
4336
4354
4337
4355
LexicalScope Scope (*this , S.getSourceRange ());
4338
4356
EmitStopPoint (&S);
4339
- Builder.restoreIP (OMPBuilder.createSection (Builder, BodyGenCB, FiniCB));
4357
+ llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
4358
+ OMPBuilder.createSection (Builder, BodyGenCB, FiniCB);
4359
+ assert (AfterIP && " unexpected error creating section" );
4360
+ Builder.restoreIP (*AfterIP);
4340
4361
4341
4362
return ;
4342
4363
}
@@ -4407,17 +4428,22 @@ void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) {
4407
4428
4408
4429
auto FiniCB = [this ](InsertPointTy IP) {
4409
4430
OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4431
+ return llvm::Error::success ();
4410
4432
};
4411
4433
4412
4434
auto BodyGenCB = [MasterRegionBodyStmt, this ](InsertPointTy AllocaIP,
4413
4435
InsertPointTy CodeGenIP) {
4414
4436
OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
4415
4437
*this , MasterRegionBodyStmt, AllocaIP, CodeGenIP, " master" );
4438
+ return llvm::Error::success ();
4416
4439
};
4417
4440
4418
4441
LexicalScope Scope (*this , S.getSourceRange ());
4419
4442
EmitStopPoint (&S);
4420
- Builder.restoreIP (OMPBuilder.createMaster (Builder, BodyGenCB, FiniCB));
4443
+ llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
4444
+ OMPBuilder.createMaster (Builder, BodyGenCB, FiniCB);
4445
+ assert (AfterIP && " unexpected error creating master" );
4446
+ Builder.restoreIP (*AfterIP);
4421
4447
4422
4448
return ;
4423
4449
}
@@ -4453,18 +4479,22 @@ void CodeGenFunction::EmitOMPMaskedDirective(const OMPMaskedDirective &S) {
4453
4479
4454
4480
auto FiniCB = [this ](InsertPointTy IP) {
4455
4481
OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4482
+ return llvm::Error::success ();
4456
4483
};
4457
4484
4458
4485
auto BodyGenCB = [MaskedRegionBodyStmt, this ](InsertPointTy AllocaIP,
4459
4486
InsertPointTy CodeGenIP) {
4460
4487
OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
4461
4488
*this , MaskedRegionBodyStmt, AllocaIP, CodeGenIP, " masked" );
4489
+ return llvm::Error::success ();
4462
4490
};
4463
4491
4464
4492
LexicalScope Scope (*this , S.getSourceRange ());
4465
4493
EmitStopPoint (&S);
4466
- Builder.restoreIP (
4467
- OMPBuilder.createMasked (Builder, BodyGenCB, FiniCB, FilterVal));
4494
+ llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
4495
+ OMPBuilder.createMasked (Builder, BodyGenCB, FiniCB, FilterVal);
4496
+ assert (AfterIP && " unexpected error creating masked" );
4497
+ Builder.restoreIP (*AfterIP);
4468
4498
4469
4499
return ;
4470
4500
}
@@ -4493,19 +4523,23 @@ void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) {
4493
4523
4494
4524
auto FiniCB = [this ](InsertPointTy IP) {
4495
4525
OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
4526
+ return llvm::Error::success ();
4496
4527
};
4497
4528
4498
4529
auto BodyGenCB = [CriticalRegionBodyStmt, this ](InsertPointTy AllocaIP,
4499
4530
InsertPointTy CodeGenIP) {
4500
4531
OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
4501
4532
*this , CriticalRegionBodyStmt, AllocaIP, CodeGenIP, " critical" );
4533
+ return llvm::Error::success ();
4502
4534
};
4503
4535
4504
4536
LexicalScope Scope (*this , S.getSourceRange ());
4505
4537
EmitStopPoint (&S);
4506
- Builder.restoreIP (OMPBuilder.createCritical (
4507
- Builder, BodyGenCB, FiniCB, S.getDirectiveName ().getAsString (),
4508
- HintInst));
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);
4509
4543
4510
4544
return ;
4511
4545
}
@@ -5464,11 +5498,15 @@ void CodeGenFunction::EmitOMPTaskgroupDirective(
5464
5498
InsertPointTy CodeGenIP) {
5465
5499
Builder.restoreIP (CodeGenIP);
5466
5500
EmitStmt (S.getInnermostCapturedStmt ()->getCapturedStmt ());
5501
+ return llvm::Error::success ();
5467
5502
};
5468
5503
CodeGenFunction::CGCapturedStmtInfo CapStmtInfo;
5469
5504
if (!CapturedStmtInfo)
5470
5505
CapturedStmtInfo = &CapStmtInfo;
5471
- Builder.restoreIP (OMPBuilder.createTaskgroup (Builder, AllocaIP, BodyGenCB));
5506
+ llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
5507
+ OMPBuilder.createTaskgroup (Builder, AllocaIP, BodyGenCB);
5508
+ assert (AfterIP && " unexpected error creating taskgroup" );
5509
+ Builder.restoreIP (*AfterIP);
5472
5510
return ;
5473
5511
}
5474
5512
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) {
@@ -6041,6 +6079,7 @@ void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) {
6041
6079
6042
6080
auto FiniCB = [this ](InsertPointTy IP) {
6043
6081
OMPBuilderCBHelpers::FinalizeOMPRegion (*this , IP);
6082
+ return llvm::Error::success ();
6044
6083
};
6045
6084
6046
6085
auto BodyGenCB = [&S, C, this ](InsertPointTy AllocaIP,
@@ -6064,11 +6103,14 @@ void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) {
6064
6103
OMPBuilderCBHelpers::EmitOMPInlinedRegionBody (
6065
6104
*this , CS->getCapturedStmt (), AllocaIP, CodeGenIP, " ordered" );
6066
6105
}
6106
+ return llvm::Error::success ();
6067
6107
};
6068
6108
6069
6109
OMPLexicalScope Scope (*this , S, OMPD_unknown);
6070
- Builder.restoreIP (
6071
- OMPBuilder.createOrderedThreadsSimd (Builder, BodyGenCB, FiniCB, !C));
6110
+ llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
6111
+ OMPBuilder.createOrderedThreadsSimd (Builder, BodyGenCB, FiniCB, !C);
6112
+ assert (AfterIP && " unexpected error creating ordered" );
6113
+ Builder.restoreIP (*AfterIP);
6072
6114
}
6073
6115
return ;
6074
6116
}
@@ -7344,8 +7386,10 @@ void CodeGenFunction::EmitOMPCancelDirective(const OMPCancelDirective &S) {
7344
7386
if (IfCond)
7345
7387
IfCondition = EmitScalarExpr (IfCond,
7346
7388
/* IgnoreResultAssign=*/ true );
7347
- return Builder.restoreIP (
7348
- OMPBuilder.createCancel (Builder, IfCondition, S.getCancelRegion ()));
7389
+ llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
7390
+ OMPBuilder.createCancel (Builder, IfCondition, S.getCancelRegion ());
7391
+ assert (AfterIP && " unexpected error creating cancel" );
7392
+ return Builder.restoreIP (*AfterIP);
7349
7393
}
7350
7394
}
7351
7395
0 commit comments