[llvm-branch-commits] [clang] [clang][OpenMP] Extend no-loop promotion to the split teams loop (PR #224650)

Nicole Aschenbrenner via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Oct 19 07:50:31 PDT 2026


================
@@ -706,27 +706,73 @@ static bool supportsSPMDExecutionMode(ASTContext &Ctx,
       "Unknown programming model for OpenMP directive on NVPTX target.");
 }
 
+static bool isNoLoopCompatibleSchedule(ASTContext &Ctx,
+                                       const OMPLoopDirective &LD) {
+  const auto *C = LD.getSingleClause<OMPScheduleClause>();
+  if (!C)
+    return true;
+
+  switch (C->getScheduleKind()) {
+  case OMPC_SCHEDULE_guided:
+  case OMPC_SCHEDULE_runtime:
+    return false;
+  case OMPC_SCHEDULE_auto:
+    return true;
+  default: {
+    const Expr *ChunkSize = C->getChunkSize();
+    Expr::EvalResult Result;
+    if (!ChunkSize || !ChunkSize->EvaluateAsInt(Result, Ctx))
+      return false;
+    return Result.Val.getInt().getLimitedValue() == 1;
+  }
+  }
+}
+
 static bool isNoLoopEligible(ASTContext &Ctx, const OMPExecutableDirective &D) {
----------------
nicebert wrote:

I've implemented this in #224041, so this PR picks it up once I rebase it onto the updated base.

https://github.com/llvm/llvm-project/pull/224650


More information about the llvm-branch-commits mailing list