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

Nicole Aschenbrenner via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 25 05:02:44 PDT 2026


================
@@ -746,9 +758,14 @@ void CGOpenMPRuntimeGPU::emitKernelInit(const OMPExecutableDirective &D,
                                         CodeGenFunction &CGF,
                                         EntryFunctionState &EST, bool IsSPMD) {
   llvm::OpenMPIRBuilder::TargetKernelDefaultAttrs Attrs;
-  Attrs.ExecFlags =
-      IsSPMD ? llvm::omp::OMPTgtExecModeFlags::OMP_TGT_EXEC_MODE_SPMD
-             : llvm::omp::OMPTgtExecModeFlags::OMP_TGT_EXEC_MODE_GENERIC;
+  if (IsSPMD && canPromoteToNoLoop(CGM.getLangOpts(), D))
+    Attrs.ExecFlags =
----------------
nicebert wrote:

you're right and I think I should add it not as a separate PR but as part of this one instead. even though it passes the clang port of the flang test I added it's not truly no-loop yet in this state

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


More information about the cfe-commits mailing list