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

Robert Imschweiler via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 30 04:34:33 PDT 2026


================
@@ -6309,9 +6340,11 @@ void CodeGenFunction::EmitOMPDistributeLoop(const OMPLoopDirective &S,
       const unsigned IVSize = getContext().getTypeSize(IVExpr->getType());
       const bool IVSigned = IVExpr->getType()->hasSignedIntegerRepresentation();
 
-      // GPU fused schedule: omit the outer distribute loop and let the inner
-      // worksharing loop schedule the flattened team/thread iteration space.
-      if (canEmitGPUFusedDistSchedule(CGM, S, S.getDirectiveKind())) {
+      // omit the outer distribute loop and let the inner worksharing loop
+      // schedule the flattened team/thread iteration space, necessary for
+      // GPU fused schedule and no-loop optimization
+      if (canEmitGPUFusedDistSchedule(CGM, S, S.getDirectiveKind()) ||
----------------
ro-i wrote:

note that in my initial current design, this place has to agree with
```c++
      ScheduleKind.UseFusedDistChunkSchedule =
          canEmitGPUFusedDistSchedule(CGM, S, EKind);
```
earlier in the file.
This is probably not an issue right now because EmitOMPWorksharingLoop is skipped at the moment, but flagging this for the case this changes

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


More information about the cfe-commits mailing list