[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
Thu May 13 11:46:51 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:
> arnamoy10 wrote:
> > 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.
> OK. 
> What do you think about the following?
> Collect all symbols in the linear clause in linearSet. If not empty, go through the associated loops and remove iteration variable symbols from the linearSet. For anything remaining in the linearSet, print errors. 
> This will only be a rearrangement of the current code.    
Thanks, updated as per suggestion.


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

https://reviews.llvm.org/D100224



More information about the llvm-commits mailing list