================
@@ -7571,10 +7632,34 @@ static void 
emitCommonOMPTargetDirective(CodeGenFunction &CGF,
     if (IsOffloadEntry) {
       OMPLoopScope PreInitScope(CGF, D);
       // Emit calculation of the iterations count.
-      llvm::Value *NumIterations = CGF.EmitScalarExpr(D.getNumIterations());
-      NumIterations = CGF.Builder.CreateIntCast(NumIterations, CGF.Int64Ty,
-                                                /*isSigned=*/false);
-      return NumIterations;
+      auto EmitNumIterations = [&CGF, &D]() {
+        return CGF.Builder.CreateIntCast(
+            CGF.EmitScalarExpr(D.getNumIterations()), CGF.Int64Ty,
+            /*isSigned=*/false);
+      };
+      const LangOptions &LangOpts = CGF.getLangOpts();
+      if (!LangOpts.OpenMPTeamSubscription ||
----------------
dhruvachak wrote:

This conditional early-exit should be removed since the bugfix should apply to 
all execution modes. But suggest making this change in a separate PR since it 
is likely to incur test churn.

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