================
@@ -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);
----------------
nicebert wrote:

> I think we talked about this already at some point, but why doesn't 
> firstprivate need to be handled here, too?

It does not. firstprivate is already handled at the distribute level for SPMD 
kernels.

> 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

I think that's a design preference. This PR follows how the loop emission is 
structured today and I think separating it is its own refactor.

https://github.com/llvm/llvm-project/pull/224041
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to