[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
Wed May 5 14:18:33 PDT 2021


arnamoy10 added inline comments.


================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:341
+  const auto &clauses{std::get<parser::OmpClauseList>(beginLoopDir.t)};
+
+  // Get collapse level, if given, to find which loops are "associated."
----------------
kiranchandramohan wrote:
> kiranchandramohan wrote:
> > Would it be possible to go through the linear clause first? If there is no linear clause there is no need to go through the iteration variables.
> If you do this check in Leave then you can probably use FindClause/FindClauses.
Unfortunately, the check cannot be done in `Leave()`, because `EndLoopDirective` is `Enter()`-ed before, which erases the clauselist using [[ https://github.com/llvm/llvm-project/blob/1817dae1924144c19b9caec196f574c51d6d9957/flang/lib/Semantics/check-omp-structure.cpp#L390 | ResetPartialContext() ]].  So `FindClause`/`FindClauses` cannot retrieve the clause list anymore

So checking for linear clause first also is not helpful here.


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

https://reviews.llvm.org/D100224



More information about the llvm-commits mailing list