@@ -9489,18 +9489,30 @@ static llvm::Value *emitDeviceID(
9489
9489
return DeviceID;
9490
9490
}
9491
9491
9492
- static llvm::Value *emitDynCGGroupMem(const OMPExecutableDirective &D,
9493
- CodeGenFunction &CGF) {
9494
- llvm::Value *DynCGroupMem = CGF.Builder.getInt32(0);
9495
-
9496
- if (auto *DynMemClause = D.getSingleClause<OMPXDynCGroupMemClause>()) {
9497
- CodeGenFunction::RunCleanupsScope DynCGroupMemScope(CGF);
9498
- llvm::Value *DynCGroupMemVal = CGF.EmitScalarExpr(
9499
- DynMemClause->getSize(), /*IgnoreResultAssign=*/true);
9500
- DynCGroupMem = CGF.Builder.CreateIntCast(DynCGroupMemVal, CGF.Int32Ty,
9501
- /*isSigned=*/false);
9502
- }
9503
- return DynCGroupMem;
9492
+ static std::pair<llvm::Value *, bool>
9493
+ emitDynCGroupMem(const OMPExecutableDirective &D, CodeGenFunction &CGF) {
9494
+ llvm::Value *DynGP = CGF.Builder.getInt32(0);
9495
+ bool DynGPFallback = false;
9496
+
9497
+ if (auto *DynGPClause = D.getSingleClause<OMPDynGroupprivateClause>()) {
9498
+ CodeGenFunction::RunCleanupsScope DynGPScope(CGF);
9499
+ llvm::Value *DynGPVal =
9500
+ CGF.EmitScalarExpr(DynGPClause->getSize(), /*IgnoreResultAssign=*/true);
9501
+ DynGP = CGF.Builder.CreateIntCast(DynGPVal, CGF.Int32Ty,
9502
+ /*isSigned=*/false);
9503
+ DynGPFallback = (DynGPClause->getFirstDynGroupprivateModifier() !=
9504
+ OMPC_DYN_GROUPPRIVATE_strict &&
9505
+ DynGPClause->getSecondDynGroupprivateModifier() !=
9506
+ OMPC_DYN_GROUPPRIVATE_strict);
9507
+ } else if (auto *OMPXDynCGClause =
9508
+ D.getSingleClause<OMPXDynCGroupMemClause>()) {
9509
+ CodeGenFunction::RunCleanupsScope DynCGMemScope(CGF);
9510
+ llvm::Value *DynCGMemVal = CGF.EmitScalarExpr(OMPXDynCGClause->getSize(),
9511
+ /*IgnoreResultAssign=*/true);
9512
+ DynGP = CGF.Builder.CreateIntCast(DynCGMemVal, CGF.Int32Ty,
9513
+ /*isSigned=*/false);
9514
+ }
9515
+ return {DynGP, DynGPFallback};
9504
9516
}
9505
9517
static void genMapInfoForCaptures(
9506
9518
MappableExprsHandler &MEHandler, CodeGenFunction &CGF,
@@ -9710,7 +9722,7 @@ static void emitTargetCallKernelLaunch(
9710
9722
llvm::Value *RTLoc = OMPRuntime->emitUpdateLocation(CGF, D.getBeginLoc());
9711
9723
llvm::Value *NumIterations =
9712
9724
OMPRuntime->emitTargetNumIterationsCall(CGF, D, SizeEmitter);
9713
- llvm::Value *DynCGGroupMem = emitDynCGGroupMem (D, CGF);
9725
+ auto [DynCGroupMem, DynCGroupMemFallback] = emitDynCGroupMem (D, CGF);
9714
9726
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP(
9715
9727
CGF.AllocaInsertPt->getParent(), CGF.AllocaInsertPt->getIterator());
9716
9728
@@ -9720,7 +9732,7 @@ static void emitTargetCallKernelLaunch(
9720
9732
9721
9733
llvm::OpenMPIRBuilder::TargetKernelArgs Args(
9722
9734
NumTargetItems, RTArgs, NumIterations, NumTeams, NumThreads,
9723
- DynCGGroupMem , HasNoWait);
9735
+ DynCGroupMem , HasNoWait, DynCGroupMemFallback );
9724
9736
9725
9737
llvm::OpenMPIRBuilder::InsertPointTy AfterIP =
9726
9738
cantFail(OMPRuntime->getOMPBuilder().emitKernelLaunch(
0 commit comments