[PATCH] D105874: [flang][OpenMP] Add semantic check for reduction clause in taskloop simd construct

Peixin Qiao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 06:46:26 PDT 2021


peixin added a comment.

@kiranchandramohan Thanks for the guide to submit patches and the comments.

The standard is at page 92 in openmp-4.5 specification, which I quote:

  Restrictions
  The restrictions for the taskloop and simd constructs apply.
  No reduction clause can be specified.

I argee that saying the clause is not allowed in the directive is better. Changed the code fix and test case error info. It is common semantic check in `DirectiveStructureChecker` in `flang/lib/Semantics/check-directive-structure.h`, which I quote in the following:

  if (!GetContext().allowedClauses.test(clause) &&
      !GetContext().allowedOnceClauses.test(clause) &&
      !GetContext().allowedExclusiveClauses.test(clause) &&
      !GetContext().requiredClauses.test(clause)) {
    context_.Say(GetContext().clauseSource,
        "%s clause is not allowed on the %s directive"_err_en_US,
        parser::ToUpperCaseLetters(getClauseName(clause).str()),
        parser::ToUpperCaseLetters(GetContext().directiveSource.ToString()));
    return;
  }

The reason why it is not checked in `DirectiveStructureChecker` is the clause `OMPC_Reduction` is defined inside `OMP_TaskLoopSimd` in `llvm/include/llvm/Frontend/OpenMP/OMP.td`.
I also noticed that there is no this restriction in openmp-5.0 specification.


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

https://reviews.llvm.org/D105874



More information about the llvm-commits mailing list