================
@@ -2733,14 +2786,33 @@ SemaOpenACC::CreateInitRecipe(OpenACCClauseKind CK,
         // are used for code generation, we can just ignore/not bother doing 
any
         // initialization here.
         break;
-      case OpenACCReductionOperator::Multiplication:
       case OpenACCReductionOperator::Max:
       case OpenACCReductionOperator::Min:
       case OpenACCReductionOperator::BitwiseAnd:
-      case OpenACCReductionOperator::And:
         // TODO: OpenACC: figure out init for these.
         break;
 
+      case OpenACCReductionOperator::Multiplication:
+      case OpenACCReductionOperator::And: {
+        // '&&' initializes every field to 1.  However, we need to loop through
+        // every field/element and generate an initializer for each of the
+        // elements.
+
+        Expr *InitExpr = GenerateReductionInitRecipeExpr(
+            getASTContext(), VarExpr->getSourceRange(), VarTy);
+
+        if (InitExpr) {
----------------
andykaylor wrote:

These lines seem to be shared with the zero initializer case, and will probably 
match the other kinds too. Maybe make it a lambda?

https://github.com/llvm/llvm-project/pull/156122
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to