@@ -9582,6 +9582,20 @@ static void genMapInfo(const OMPExecutableDirective &D, CodeGenFunction &CGF,
9582
9582
MappedVarSet, CombinedInfo);
9583
9583
genMapInfo(MEHandler, CGF, CombinedInfo, OMPBuilder, MappedVarSet);
9584
9584
}
9585
+
9586
+ static void emitNumTeamsForBareTargetDirective(
9587
+ CodeGenFunction &CGF, const OMPExecutableDirective &D,
9588
+ llvm::SmallVectorImpl<llvm::Value *> &NumTeams) {
9589
+ const auto *C = D.getSingleClause<OMPNumTeamsClause>();
9590
+ assert(!C->varlist_empty() && "ompx_bare requires explicit num_teams");
9591
+ CodeGenFunction::RunCleanupsScope NumTeamsScope(CGF);
9592
+ for (auto *E : C->getNumTeams()) {
9593
+ llvm::Value *V = CGF.EmitScalarExpr(E);
9594
+ NumTeams.push_back(
9595
+ CGF.Builder.CreateIntCast(V, CGF.Int32Ty, /*isSigned=*/true));
9596
+ }
9597
+ }
9598
+
9585
9599
static void emitTargetCallKernelLaunch(
9586
9600
CGOpenMPRuntime *OMPRuntime, llvm::Function *OutlinedFn,
9587
9601
const OMPExecutableDirective &D,
@@ -9651,8 +9665,14 @@ static void emitTargetCallKernelLaunch(
9651
9665
return CGF.Builder.saveIP();
9652
9666
};
9653
9667
9668
+ bool IsBare = D.hasClausesOfKind<OMPXBareClause>();
9669
+ SmallVector<llvm::Value *, 3> NumTeams;
9670
+ if (IsBare)
9671
+ emitNumTeamsForBareTargetDirective(CGF, D, NumTeams);
9672
+ else
9673
+ NumTeams.push_back(OMPRuntime->emitNumTeamsForTargetDirective(CGF, D));
9674
+
9654
9675
llvm::Value *DeviceID = emitDeviceID(Device, CGF);
9655
- llvm::Value *NumTeams = OMPRuntime->emitNumTeamsForTargetDirective(CGF, D);
9656
9676
llvm::Value *NumThreads =
9657
9677
OMPRuntime->emitNumThreadsForTargetDirective(CGF, D);
9658
9678
llvm::Value *RTLoc = OMPRuntime->emitUpdateLocation(CGF, D.getBeginLoc());
0 commit comments