[PATCH] D114941: [flang][OpenMP] Add some semantic checks for threadprivate and declare target directives

Peixin Qiao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 2 03:24:47 PST 2021


peixin created this revision.
peixin added reviewers: kiranchandramohan, clementval, ftynse, jdoerfert, shraiysh, Leporacanthicus, Meinersbur, kiranktp, arnamoy10, bryanpkc, Chuanfeng.
peixin added projects: Flang, LLVM.
Herald added subscribers: guansong, yaxunl.
Herald added a reviewer: sscalpone.
peixin requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1.

This supports the following checks for THREADPRIVATE Directive:

  [5.1] 2.21.2 THREADPRIVATE Directive
  The threadprivate directive must appear in the declaration section of a
  scoping unit in which the common block or variable is declared.
  A threadprivate variable must not appear in any clause except the 
  copyin, copyprivate, schedule, num_threads, thread_limit, and if clauses.

This supports the following checks for DECLARE TARGET Directive:

  [5.1] 2.14.7 Declare Target Directive
  A threadprivate variable cannot appear in the directive.
  The directive must appear in the declaration section of a scoping unit
  in which the common block or variable is declared.

Besides, procedure name and the entity with PARAMETER attribute cannot
be in the threadprivate directive. The main program name and module name
cannot be in the threadprivate directive and declare target directive.
There is no clear description or restriction about the entity with
PARAMETER attribute in OpenMP 5.1 Specification, and a warning is given.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114941

Files:
  flang/lib/Semantics/check-omp-structure.cpp
  flang/test/Semantics/omp-declarative-directive.f90
  flang/test/Semantics/omp-declare-target02.f90
  flang/test/Semantics/omp-declare-target03.f90
  flang/test/Semantics/omp-declare-target04.f90
  flang/test/Semantics/omp-declare-target05.f90
  flang/test/Semantics/omp-threadprivate02.f90
  flang/test/Semantics/omp-threadprivate03.f90
  flang/test/Semantics/omp-threadprivate04.f90
  flang/test/Semantics/omp-threadprivate05.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114941.391268.patch
Type: text/x-patch
Size: 20069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211202/46533ecd/attachment.bin>


More information about the llvm-commits mailing list