@@ -9576,6 +9576,20 @@ static void genMapInfo(const OMPExecutableDirective &D, CodeGenFunction &CGF,
9576
9576
MappedVarSet, CombinedInfo);
9577
9577
genMapInfo(MEHandler, CGF, CombinedInfo, OMPBuilder, MappedVarSet);
9578
9578
}
9579
+
9580
+ static void emitNumTeamsForBareTargetDirective(
9581
+ CodeGenFunction &CGF, const OMPExecutableDirective &D,
9582
+ llvm::SmallVectorImpl<llvm::Value *> &NumTeams) {
9583
+ const auto *C = D.getSingleClause<OMPNumTeamsClause>();
9584
+ assert(!C->varlist_empty() && "ompx_bare requires explicit num_teams");
9585
+ CodeGenFunction::RunCleanupsScope NumTeamsScope(CGF);
9586
+ for (auto *E : C->getNumTeams()) {
9587
+ llvm::Value *V = CGF.EmitScalarExpr(E);
9588
+ NumTeams.push_back(
9589
+ CGF.Builder.CreateIntCast(V, CGF.Int32Ty, /*isSigned=*/true));
9590
+ }
9591
+ }
9592
+
9579
9593
static void emitTargetCallKernelLaunch(
9580
9594
CGOpenMPRuntime *OMPRuntime, llvm::Function *OutlinedFn,
9581
9595
const OMPExecutableDirective &D,
@@ -9645,8 +9659,14 @@ static void emitTargetCallKernelLaunch(
9645
9659
return CGF.Builder.saveIP();
9646
9660
};
9647
9661
9662
+ bool IsBare = D.hasClausesOfKind<OMPXBareClause>();
9663
+ SmallVector<llvm::Value *, 3> NumTeams;
9664
+ if (IsBare)
9665
+ emitNumTeamsForBareTargetDirective(CGF, D, NumTeams);
9666
+ else
9667
+ NumTeams.push_back(OMPRuntime->emitNumTeamsForTargetDirective(CGF, D));
9668
+
9648
9669
llvm::Value *DeviceID = emitDeviceID(Device, CGF);
9649
- llvm::Value *NumTeams = OMPRuntime->emitNumTeamsForTargetDirective(CGF, D);
9650
9670
llvm::Value *NumThreads =
9651
9671
OMPRuntime->emitNumThreadsForTargetDirective(CGF, D);
9652
9672
llvm::Value *RTLoc = OMPRuntime->emitUpdateLocation(CGF, D.getBeginLoc());
0 commit comments