[clang] [OpenACC] Implement 'reduction' sema for compute constructs (PR #92808)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon May 20 12:28:31 PDT 2024


================
@@ -426,6 +438,24 @@ SemaOpenACC::ActOnClause(ArrayRef<const OpenACCClause *> ExistingClauses,
           << /*NoArgs=*/1 << Clause.getDirectiveKind() << MaxArgs
           << Clause.getIntExprs().size();
 
+    // OpenACC 3.3 Section 2.5.4:
+    // A reduction clause may not appear on a parallel construct with a
+    // num_gangs clause that has more than one argument.
+    if (Clause.getDirectiveKind() == OpenACCDirectiveKind::Parallel &&
+        Clause.getIntExprs().size() > 1) {
+      auto *Parallel =
+          llvm::find_if(ExistingClauses, [](const OpenACCClause *C) {
+            return C->getClauseKind() == OpenACCClauseKind::Reduction;
+          });
----------------
erichkeane wrote:

That is awesome, thank you for showing me this!

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


More information about the cfe-commits mailing list