[PATCH] D100224: [flang][OpenMP] Add semantic check for occurrence of variables other than loop iteration variable in a `linear` clause associated with a `distribute` construct.

Arnamoy B via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 12:54:36 PDT 2021


arnamoy10 added inline comments.


================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:344-351
+  for (const auto &clause : clauses.v) {
+    if (const auto *collapseClause{
+            std::get_if<parser::OmpClause::Collapse>(&clause.u)}) {
+      if (const auto cVal{GetIntValue(collapseClause->v)}) {
+        collapseVal = *cVal;
+      }
+    }
----------------
kiranchandramohan wrote:
> Nit: There is a function GetOrdCollapseLevel which you can possibly use.
Thanks, modified.


================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:400
+          context_.Say(v.source,
+              "Variable '%s' not allowed at `LINEAR` clause, only loop iterator can be specified in `LINEAR` clause of a construct combined with `DISTRIBUTE`"_err_en_US,
+              v.ToString());
----------------
kiranchandramohan wrote:
> Nit: at -> in?
Thanks, modified


================
Comment at: flang/lib/Semantics/check-omp-structure.h:77-78
+    Directive::OMPD_distribute_parallel_do_simd,
+    Directive::OMPD_distribute_parallel_for,
+    Directive::OMPD_distribute_parallel_for_simd,
+    Directive::OMPD_distribute_simd};
----------------
kiranchandramohan wrote:
> Nit: Are these two fors required? Do these apply for Fortran? 
Thanks, removed..


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100224/new/

https://reviews.llvm.org/D100224



More information about the llvm-commits mailing list