[clang] [llvm] [clang][OpenMP] Add no-loop SPMD kernel promotion (PR #224041)
Robert Imschweiler via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 8 05:21:32 PDT 2026
================
@@ -3934,6 +3961,55 @@ emitInnerParallelForWhenCombined(CodeGenFunction &CGF,
HasCancel = D->hasCancel();
}
CodeGenFunction::OMPCancelStackRAII CancelRegion(CGF, EKind, HasCancel);
+
+ CodeGenModule &CGM = CGF.CGM;
+ if (CGM.getOpenMPRuntime().canPromoteToNoLoop()) {
+ // Prepare the loop variables and their privatization.
+ emitLoopIterationspaceVars(CGF, S);
+ OMPLoopScope PreInitScope(CGF, S);
+
+ CodeGenFunction::OMPPrivateScope PrivateScope(CGF);
+ CGF.EmitOMPPrivateClause(S, PrivateScope);
----------------
ro-i wrote:
I think we talked about this already at some point, but why doesn't firstprivate need to be handled here, too?
I still think that everything would be simpler if there would be a clean split between loop (structure) emitting and loop body emitting. This way, you always need to sync and keep up with EmitOMPWorksharingLoop. But maybe I'm missing something
https://github.com/llvm/llvm-project/pull/224041
More information about the cfe-commits
mailing list