[clang] [llvm] [clang][OpenMP] Add no-loop SPMD kernel promotion (PR #224041)

Dhruva Chakrabarti via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 23:14:36 PDT 2026


================
@@ -3710,6 +3746,55 @@ emitInnerParallelForWhenCombined(CodeGenFunction &CGF,
         HasCancel = D->hasCancel();
     }
     CodeGenFunction::OMPCancelStackRAII CancelRegion(CGF, EKind, HasCancel);
+
+    CodeGenModule &CGM = CGF.CGM;
+    if (canEmitGPUNoLoopKernel(CGM, S)) {
+      // Prepare the loop variables and their privatization.
+      emitLoopIterationspaceVars(CGF, S);
+      OMPLoopScope PreInitScope(CGF, S);
+
+      CodeGenFunction::OMPPrivateScope PrivateScope(CGF);
+      CGF.EmitOMPPrivateClause(S, PrivateScope);
+      CGF.EmitOMPPrivateLoopCounters(S, PrivateScope);
+      (void)PrivateScope.Privatize();
+
+      if (isOpenMPTargetExecutionDirective(EKind))
----------------
dhruvachak wrote:

No test for this one either.

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


More information about the llvm-commits mailing list